Hi dalu,
hast du Erfahrung mit der Einrichtung von Kubernetes mit kubeadm?
Mein Aufbau ist folgender:
Windows10 mit VirtualBox.
3 virtuelle Ubuntu Maschinen.
Erster für die controlplane, die beiden anderen als Workernodes.
Bei der Einrichtung gehe ich nach einem Tutorial von Kodekloud auf udemy.
Folgende Schritt führe ich auf allen VM’s aus:
Forwarding IPv4 and letting iptables see bridged traffic:
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system
lsmod | grep br_netfilter
lsmod | grep overlay
sysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward
Setting up container runtime containerd:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL [SSL://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc]
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo
“deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] SSL://download.docker.com/linux/ubuntu
$(. /etc/os-release && echo “$VERSION_CODENAME”) stable” |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install containerd.io
systemctl status containerd
Setting up cgroup drivers:
ps -p 1
nano /etc/containerd/config.toml
[plugins.“io.containerd.grpc.v1.cri”.containerd.runtimes.runc]
[plugins.“io.containerd.grpc.v1.cri”.containerd.runtimes.runc.options]
SystemdCgroup = true
sudo systemctl restart containerd
systemctl status containerd
Setting up kubeadm, kubelet and kubectl:
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gpg
curl -fsSL SSL://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo ‘deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /’ | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
Ich führe bei der controlplane die Befehle aus:
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.1.25
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get pods -A
E0419 18:41:12.609267 9082 memcache.go:265] couldn’t get current server API group list: Get “SSL://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E0419 18:41:12.610226 9082 memcache.go:265] couldn’t get current server API group list: Get “SSL://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E0419 18:41:12.610597 9082 memcache.go:265] couldn’t get current server API group list: Get “SSL://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E0419 18:41:12.611866 9082 memcache.go:265] couldn’t get current server API group list: Get “SSL://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E0419 18:41:12.611977 9082 memcache.go:265] couldn’t get current server API group list: Get “SSL://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
The connection to the server localhost:8080 was refused - did you specify the right host or port?
E0419 18:41:12.610226 9082 memcache.go:265] couldn’t get current server API group list: Get “SSL://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E0419 18:41:12.610597 9082 memcache.go:265] couldn’t get current server API group list: Get “SSL://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
E0419 18:41:12.611866 9082 memcache.go:265] couldn’t get current server API group list: Get “SSL://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
syslog:
“Error updating node status, will retry” err=“error getting node "controlplane": Get "SSL://192.168.1.25:6443/api/v1/nodes/controlplane?timeout=10s": dial tcp 192.168.1.25:6443: connect: connection refused”
“Nameserver limits exceeded” err=“Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 8.8.8.8 10.0.2.3 192.168.1.1”
“Container runtime network not ready” networkReady=“NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized”
Apr 19 18:55:54 ubuntu-jammy kubelet[8541]: I0419 18:55:54.754735 8541 status_manager.go:853] “Failed to get status for pod” podUID=“69efa91f6a62aaefe4a4a86f87fcdabf” pod=“kube-system/kube-apiserver-controlplane” err=“Get "SSL://192.168.1.25:6443/api/v1/namespaces/kube-system/pods/kube-apiserver-controlplane": dial tcp 192.168.1.25:6443: connect: connection refused”
Apr 19 18:55:54 ubuntu-jammy kubelet[8541]: I0419 18:55:54.754873 8541 status_manager.go:853] “Failed to get status for pod” podUID=“ed2a34556bcf5dfe974cf16b6504f04d” pod=“kube-system/kube-controller-manager-controlplane” err=“Get "SSL://192.168.1.25:6443/api/v1/namespaces/kube-system/pods/kube-controller-manager-controlplane": dial tcp 192.168.1.25:6443: connect: connection refused”
Apr 19 18:55:54 ubuntu-jammy kubelet[8541]: I0419 18:55:54.754948 8541 status_manager.go:853] “Failed to get status for pod” podUID=“ce2a6a6d-436b-43d8-8363-7e87d7dc2d59” pod=“kube-system/kube-proxy-mnbtf” err=“Get "SSL://192.168.1.25:6443/api/v1/namespaces/kube-system/pods/kube-proxy-mnbtf": dial tcp 192.168.1.25:6443: connect: connection refused”
Apr 19 18:55:54 ubuntu-jammy kubelet[8541]: I0419 18:55:54.755024 8541 status_manager.go:853] “Failed to get status for pod” podUID=“db172d5b3add27a8cc689d10fd0e2f4c” pod=“kube-system/kube-scheduler-controlplane” err=“Get "SSL://192.168.1.25:6443/api/v1/namespaces/kube-system/pods/kube-scheduler-controlplane": dial tcp 192.168.1.25:6443: connect: connection refused”
Apr 19 18:55:54 ubuntu-jammy kubelet[8541]: I0419 18:55:54.755092 8541 status_manager.go:853] “Failed to get status for pod” podUID=“35ffdfad0c21f80014f48abbea8a8ea2” pod=“kube-system/etcd-controlplane” err=“Get "SSL://192.168.1.25:6443/api/v1/namespaces/kube-system/pods/etcd-controlplane": dial tcp 192.168.1.25:6443: connect: connection refused”
Apr 19 18:55:54 ubuntu-jammy kubelet[8541]: E0419 18:55:54.914700 8541 controller.go:145] “Failed to ensure lease exists, will retry” err=“Get "SSL://192.168.1.25:6443/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases/controlplane?timeout=10s": dial tcp 192.168.1.25:6443: connect: connection refused” interval=“7s”
Habe ich in der Einrichtung von containerd einen Fehler gemacht?
Gibt es Probleme mit der cni?
Oder gibt es Probleme in der Versionierung.
Ich habe heute versucht es einzurichten, also wird die Installation sich auch die aktuellen Versionen geladen haben. Ich bin nach der Anleitung von kubernetes.io vorgegangen und habe den cgroup Treiber auf systemd in containerd umgestellt.
Ich freue mich sehr auf deine Antwort. Ich hoffe in Zukunft Kubernetes einrichten zu können. Ich wünsche es mir so sehr
Mit freundlichen Grüßen
Christian