kelseyhightower / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way. No scripts.
Apache License 2.0
41.3k stars 14.13k forks source link

Bootstrapping the Controller Plane api-server, controller-manager, and scheduler exit-code-1 and endless restarting #714

Open Amansg4 opened 2 years ago

Amansg4 commented 2 years ago

Heyo. During this guide I have run into a roadblock that is destroying my sanity. I have tried this guide with no modifications and with the following modifications and have come across this problem in both cases. I have localized the issue to the following components and tried to understand the details as to why this may be occurring but cannot understand.

Machine System: WSL2 backend Unbuntu partition on Windows OS (which also is utilized by my docker desktop ... I am assuming these are independent if I were to utilize the Unbuntu partition as an isolated environment that won't interfer with any docker needs) and GCloud.

The code ( which I modified slightly to use 1.24.3 kubernetes and updated versions of etcd, controller-manager, scheduler, api-server ) and results are as follows. The same thing happened when I tried the same with the guides original packages.

Utilized Code --- Screenshot 2022-07-28 205314 Screenshot 2022-07-28 205500 Screenshot 2022-07-28 205544 Screenshot 2022-07-28 205624 Screenshot 2022-07-28 205724


And results below sudo systemctl status kube-apiserver.service kube-controller-manager.service kube-scheduler.service etcd.service

Screenshot 2022-07-28 203405 Screenshot 2022-07-28 203503 Screenshot 2022-07-28 203605


Spent about a week on a few days on this and losing my mind. Any help would be appreciated, guys. Even just forwarding me off someplace to look for details.

I know I have an issue with trying to run the verifications and what-not since the replies I get amount to this error

asg4@controller-0:~$ kubectl cluster-info --kubeconfig admin.kubeconfig

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?

or

asg4@controller-0:~$ curl -H "Host: kubernetes.default.svc.cluster.local" -i http://127.0.0.1/healthz

HTTP/1.1 502 Bad Gateway
Server: nginx/1.18.0 (Ubuntu)
Date: Fri, 29 Jul 2022 04:16:39 GMT
Content-Type: text/html
Content-Length: 166
Connection: keep-alive

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
jbwtech commented 2 years ago

For me, the log indicates an issue with the encryption key. so I recreated a key and regenerate the encryption-config.yaml file. Once it was copied to /var/lib/kubernetes/ the kube-apiserver was able to start successfully.