almalinux9でkubernetesのコントロールプレーンを構築しようとするが挫折する話その２


ubuntu serverで改めてk8s構築するもなんかずっと再起動している
これk8s構築できる人いるの？

kubernetesに切り分けて動作の確認するのがないのがいけてない

なにかkubeletが 各podにkillしてるみたいなのでkubeletを適当なタイミングでstopしたら再起動地獄はしなくなった

```
root@k8s04:~# kubectl get pod --all-namespaces
NAMESPACE     NAME                            READY   STATUS             RESTARTS        AGE
kube-system   coredns-5dd5756b68-9zntk        0/1     Pending            0               11d
kube-system   coredns-5dd5756b68-dgq42        0/1     Pending            0               11d
kube-system   etcd-k8s04                      0/1     Running            581 (44m ago)   11d
kube-system   kube-apiserver-k8s04            0/1     Running            560 (43m ago)   11d
kube-system   kube-controller-manager-k8s04   0/1     Running            604 (44m ago)   11d
kube-system   kube-proxy-59k86                0/1     CrashLoopBackOff   502 (43m ago)   11d
kube-system   kube-scheduler-k8s04            0/1     Running            602 (43m ago)   11d
```
やっとkubectlコマンドが使えるようになる
dnsは意味不明だけどproxy以外はRunnningのよう
```
root@k8s04:~# cd /etc/kubernetes/manifests/
root@k8s04:/etc/kubernetes/manifests# ls -al
total 24
drwxrwxr-x 2 root root 4096 Nov 23 14:49 .
drwxrwxr-x 4 root root 4096 Nov 23 12:11 ..
-rw-r--r-- 1 root root    0 Oct 18 12:42 .kubelet-keep
-rw------- 1 root root 2403 Nov 11 22:18 etcd.yaml
-rw------- 1 root root 3892 Nov 11 22:18 kube-apiserver.yaml
-rw------- 1 root root 3279 Nov 11 22:18 kube-controller-manager.yaml
-rw------- 1 root root 1463 Nov 11 22:18 kube-scheduler.yaml
root@k8s04:/etc/kubernetes/manifests# 
```
んーyamlは動的に作ってるのかな。proxyないし
kubeletの設定ファイルからproxy消せば動くかな、、
まぁとりあえずログファイル

```
root@k8s04:~# cd /var/log/pods/kube-system_kube-proxy-59k86_dcef9ff3-a973-4733-9a71-a7bd20f10978/kube-proxy
root@k8s04:/var/log/pods/kube-system_kube-proxy-59k86_dcef9ff3-a973-4733-9a71-a7bd20f10978/kube-proxy# cat 502.log 
2023-11-23T15:02:34.227079803Z stderr F I1123 15:02:34.226988       1 server_others.go:69] "Using iptables proxy"
2023-11-23T15:02:34.233845085Z stderr F I1123 15:02:34.233751       1 node.go:141] Successfully retrieved node IP: 192.168.122.94
2023-11-23T15:02:34.23449469Z stderr F I1123 15:02:34.234451       1 conntrack.go:52] "Setting nf_conntrack_max" nfConntrackMax=131072
2023-11-23T15:02:34.243516252Z stderr F I1123 15:02:34.243436       1 server.go:632] "kube-proxy running in dual-stack mode" primary ipFamily="IPv4"
2023-11-23T15:02:34.244550902Z stderr F I1123 15:02:34.244497       1 server_others.go:152] "Using iptables Proxier"
2023-11-23T15:02:34.244560481Z stderr F I1123 15:02:34.244507       1 server_others.go:412] "Detect-local-mode set to ClusterCIDR, but no cluster CIDR defined"
2023-11-23T15:02:34.244562976Z stderr F I1123 15:02:34.244511       1 server_others.go:438] "Defaulting to no-op detect-local"
2023-11-23T15:02:34.244586683Z stderr F I1123 15:02:34.244530       1 server_others.go:412] "Detect-local-mode set to ClusterCIDR, but no cluster CIDR defined"
2023-11-23T15:02:34.244589327Z stderr F I1123 15:02:34.244542       1 server_others.go:438] "Defaulting to no-op detect-local"
2023-11-23T15:02:34.244633835Z stderr F I1123 15:02:34.244580       1 proxier.go:251] "Setting route_localnet=1 to allow node-ports on localhost; to change this either disable iptables.localhostNodePorts (--iptables-localhost-nodeports) or set nodePortAddresses (--nodeport-addresses) to filter loopback addresses"
2023-11-23T15:02:34.244805903Z stderr F I1123 15:02:34.244781       1 server.go:846] "Version info" version="v1.28.3"
2023-11-23T15:02:34.244828307Z stderr F I1123 15:02:34.244792       1 server.go:848] "Golang settings" GOGC="" GOMAXPROCS="" GOTRACEBACK=""
2023-11-23T15:02:34.245299652Z stderr F I1123 15:02:34.245262       1 config.go:188] "Starting service config controller"
2023-11-23T15:02:34.245306194Z stderr F I1123 15:02:34.245273       1 shared_informer.go:311] Waiting for caches to sync for service config
2023-11-23T15:02:34.245332305Z stderr F I1123 15:02:34.245313       1 config.go:97] "Starting endpoint slice config controller"
2023-11-23T15:02:34.24533503Z stderr F I1123 15:02:34.245319       1 shared_informer.go:311] Waiting for caches to sync for endpoint slice config
2023-11-23T15:02:34.245648856Z stderr F I1123 15:02:34.245616       1 config.go:315] "Starting node config controller"
2023-11-23T15:02:34.245653646Z stderr F I1123 15:02:34.245623       1 shared_informer.go:311] Waiting for caches to sync for node config
2023-11-23T15:02:34.345902933Z stderr F I1123 15:02:34.345827       1 shared_informer.go:318] Caches are synced for node config
2023-11-23T15:02:34.345952541Z stderr F I1123 15:02:34.345845       1 shared_informer.go:318] Caches are synced for service config
2023-11-23T15:02:34.345991618Z stderr F I1123 15:02:34.345880       1 shared_informer.go:318] Caches are synced for endpoint slice config
root@k8s04:/var/log/pods/kube-system_kube-proxy-59k86_dcef9ff3-a973-4733-9a71-a7bd20f10978/kube-proxy# 
```
んエラーはなしkubeletの止めたタイミングで起動されてないだけ？

kubeletからkillを止めるか、proxyを消すか

続きは次回！