Surya:
hello kodekloud friends
I have been taking up https://kodekloud.com/topic/practice-test-static-pods-2 kodekloud static pod questions.
In question 8, i am asked to
Create a static pod named static-busybox that uses the busybox image and the command sleep 1000
regardless of what i do, am not able to get correct answer for this.
I even copied the solution given
kubectl run --restart=Never --image=busybox static-busybox --dry-run=client -o yaml --command -- sleep 1000 > /etc/kubernetes/manifests/static-busybox.yaml
Should i restart the kubelete after doing this or something to get the pod running?
Thanks in advance
Alistair Mackay:
You can restart the kubelet. Maybe it did not immediately notice the new manifest file.
Ensure the pod appears when you do kubectl get pods
If it does not, you should check the kubelet logs for why it has not been created
journalctl -u kubelet
Alistair Mackay:
Also, ensure the name of the pod that has been created is static-busybox
. If it is not, then the question will be failed.
All you need to do is edit /etc/kubernetes/manifests/static-busybox.yaml
in vi after you created it and update the name, then save it again. kubelet will recreate the pod.
Surya:
i did do kubectl get pod
nothing showed up. will check kubelet
logs
Alistair Mackay:
Works for meβ¦
controlplane ~ β kubectl run --restart=Never --image=busybox static-busybox --dry-run=client -o yaml --command -- sleep 1000 > /etc/kubernetes/manifests/static-busybox.yaml
controlplane ~ β k get po -A
NAMESPACE NAME READY STATUS RESTARTS AGE
default static-busybox-controlplane 1/1 Running 0 22s
kube-flannel kube-flannel-ds-mbtsg 1/1 Running 0 10m
kube-flannel kube-flannel-ds-v262q 1/1 Running 0 9m56s
kube-system coredns-5d78c9869d-gpc57 1/1 Running 0 10m
kube-system coredns-5d78c9869d-gx2vq 1/1 Running 0 10m
kube-system etcd-controlplane 1/1 Running 0 10m
kube-system kube-apiserver-controlplane 1/1 Running 0 10m
kube-system kube-controller-manager-controlplane 1/1 Running 0 10m
kube-system kube-proxy-cxjkl 1/1 Running 0 10m
kube-system kube-proxy-w7jld 1/1 Running 0 9m56s
kube-system kube-scheduler-controlplane 1/1 Running 0 10m
You can see it at the top of the list
D. S.:
check your kubelet logs if there is any error mentioned:
journalctl -fexu kubelet