Are you looking for somewhere to learn more about Kubernetes interview questions? You’re in the right place! We publish a Kubernetes question every day on our social media channels, LinkedIn, Telegram, and YouTube, and at the end of the week, we provide the correct answers with details here. If you want to test your Kubernetes knowledge or prepare yourself for Kubernetes role interviews, follow our social media.
Follow our social media:
https://www.linkedin.com/in/ssbostan
https://www.linkedin.com/company/kubedemy
https://www.youtube.com/@kubedemy
Kubernetes Interview Questions:
28 September 2023:
Which Kubernetes component is responsible for routing Service traffic to Pods?
- A) CNI
- B) kubelet
- C) kube-proxy
- D) CRI
kube-proxy is the component which is responsible for routing Service traffic to Pods. It can be run in two modes on Linux machines. iptables mode or ipvs mode. In both cases, kube-proxy configures the underlying service to route traffic from ClusterIP to Pods.
https://kubernetes.io/docs/reference/networking/virtual-ips
29 September 2023:
Can we run a Pod without installing the CNI plugin?
- A) Yes
- B) No
Yes, we can. We can run a Kubernetes Pod in hostNetwork mode without installing any CNI plugins. When a Pod is defined with hostNetwork option, the Linux network namespace will not created for that, and the host machine network stack will be shared with the Pod’s containers. In that case, containers do not need any CNI plugin to assign them any network interfaces, configurations, etc.
02 October 2023:
Which components are mandatory to run a Pod?
- A) kube-apiserver
- B) kube-scheduler
- C) kubelet
- D) All of them
Although all components are necessary and should be installed to run a Pod in normal use cases, kubelet is the only mandatory component to run a Pod, and you can run Pods without having kube-apiserver and kube-scheduler installed. With only having kubelet and container runtime, you can run static Pods on your machine.
https://kubernetes.io/docs/tasks/configure-pod-container/static-pod
03 October 2023:
What will happen to Pods if the CNI plugin gets removed?
- A) Cluster will go out of reach
- B) All Pods will go out of reach
- C) All Pods will go to the Pending state
- D) New Pods will remain in the Pending state
Although it depends on the CNI, in most cases, removing the CNI plugin “removing CNI binaries, config files, etc.” will only affect new Pods as they can’t run without getting network configuration and IP address from the CNI plugin, but already existing Pods have their configurations, and they can work without issue.
04 October 2023:
What is the Almighty “pause” container in Kubernetes?
- A) It’s a special container to pause deployments
- B) It’s a special container to run the root privilege containers
- C) It’s a special container to share network namespace with Pod’s containers
- D) It’s a special container to pause cron jobs
If you look at the container runtime outputs, you can find that for every Kubernetes Pod, there is one “pause” container. When you run a Kubernetes Pod, at least two containers will be run. One container is the main container, as defined in PodSpec, and one container is the pause container, which runs before the main container and shares its network namespace “can share PID namespace as well” with the main container.
https://docs.mirantis.com/mke/3.4/ref-arch/pause-containers.html
05 October 2023:
How can we bypass kube-scheduler and run a Pod without scheduling?
- A) By adding nodeName in Pod spec
- B) By adding nodeSelector in Pod spec
- C) By adding topologySpreadConstraints in Pod spec
- D) By adding affinity in Pod spec
When the nodeName field of the Pod is not empty, the kube-scheduler ignores it from the scheduling decisions, and the kubelet of the mentioned node will try to run the Pod. If you provide a non-existing node, the Pod will remain in the Pending state.
https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodename
06 October 2023:
What happens if you remove a PersistentVolumeClaim in active use?
- A) The Pod will be crashed, and PVC will be removed
- B) All data will gone as soon as we delete the PVC resource
- C) We can’t delete a PVC during active use
- D) It will be deleted as soon as Pod gets stopped
Kubernetes provides a way to protect data from accidental loss/deletion. In the case of PVC deletion, if you remove a PVC in active use, “one or more running Pods are mounting it”, it’s not removed immediately. Instead, it waits until no one uses the PVC, then removes it. This protection provides you a way to get a backup of data just before deletion.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#storage-object-in-use-protection
Conclusion:
Kubernetes itself is wild. Man vs. Wild in interviews needs deep knowledge, hands-on experience and additional skills to pass. If you want to pass Kubernetes role interviews, read more and do many more with Kubernetes. Our goal in Kubedemy is to help you understand and solve Kubernetes difficulties in all situations.
If you like this series of articles, please share them and write your thoughts as comments here. Your feedback encourages me to complete this massively planned program.
Follow my LinkedIn https://www.linkedin.com/in/ssbostan
Follow Kubedemy LinkedIn https://www.linkedin.com/company/kubedemy
Follow Kubedemy Telegram https://telegram.me/kubedemy
TNX, alot.
Hello Saeid, thank you for taking the time to write these questions.
The questions are very well designed, but I suggest that the answer should be placed at the end of the questions so that we can solve the question before seeing the original answer. Thank you.
We publish all questions through our social media every day, and at the end of the week, we publish the answers here. If you are interested in having more challenges, please join our LinkedIn.
Thanks. If you mention why the others are not true and what their use cases are, then it will be fantastic.
Will work on it. Thanks for feedback.