Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

nginx - kubernetes k3s agent can't connect to master CA/SSL error

I am trying to deploy an application with k3s kubernetes. Currently I have two master nodes behind a load-balancer, and I have some issues connecting worker nodes to them. All nodes and the load-balancer runs in seperate vms.

The load balancer is a nginx server with the following configuration.

load_module /usr/lib/nginx/modules/ngx_stream_module.so;
events {}
stream {
  upstream k3s_servers {
    server {master_node1_ip}:6443;
    server {master_node2_ip}:6443;
  }
  server {
    listen 6443;
    proxy_pass k3s_servers;
  }
}

the master nodes connects through the load-balancer, and seemingly it works as expected.

ubuntu@ip-172-31-20-78:/$ sudo k3s kubectl get nodes
NAME               STATUS   ROLES                  AGE   VERSION
ip-172-31-33-183   Ready    control-plane,master   81m   v1.20.2+k3s1
ip-172-31-20-78    Ready    control-plane,master   81m   v1.20.2+k3s1

However the worker nodes yields an error about the SSL certificate?

sudo systemctl status k3s-agent
● k3s-agent.service - Lightweight Kubernetes
     Loaded: loaded (/etc/systemd/system/k3s-agent.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2021-01-24 15:54:10 UTC; 19min ago
       Docs: https://k3s.io
    Process: 3065 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=0/SUCCESS)
    Process: 3066 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
   Main PID: 3067 (k3s-agent)
      Tasks: 6
     Memory: 167.3M
     CGroup: /system.slice/k3s-agent.service
             └─3067 /usr/local/bin/k3s agent
Jan 24 16:12:23 ip-172-31-27-179 k3s[3311]: time="2021-01-24T16:34:02.483557102Z" level=info msg="Running load balancer 127.0.0.1:39357 -> [104.248.34.
Jan 24 16:12:23 ip-172-31-27-179 k3s[3067]: time="2021-01-24T16:12:23.313819380Z" level=error msg="failed to get CA certs: Get "https://127.0.0.1:339

level=error msg="failed to get CA certs: Get "https://127.0.0.1:39357/cacerts": EOF"

if I try to change K3S_URL in /etc/systemd/system/k3s-agent.service.env to use http, I get an error saying that only https is accepted.

question from:https://stackoverflow.com/questions/65872993/kubernetes-k3s-agent-cant-connect-to-master-ca-ssl-error

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...