Friday 11 June 2021

Kubernetes Interview Questions

 1. How to run Kubernetes locally?

ans: Kubernetes can be setup locally by using the minikube tool.


2. You have removed a Node from Service but it is kept in the cluster during the maintenance operation. How can you tell Kubernetes that it can resume scheduling new pods onto the node?

ans: kubectl uncordon <node-name>


3. Which command would print logs from your Pod's event with multiple containers?

Ans: kubectl logs <podname> --all-containers=true


4. What does a Kubernetes service do?

Ans: Defines a set of Pods and a policy to access them


5. What services does Ingress expose?

Ans: HTTP and HTTPS


6. What role does IP forwarding play with respect to Kubernetes?

Ans: It allows the kernel to route traffic from containers to the outside world.



7. When configuring a Highly-Available Kubernetes cluster, how many machines are needed for the masters?

Ans: 3 



8. You are creating your own StorageClass with your cluster. You create your .yaml file with parameters customized for this cluster. What is the next step in order to complete this setup?

Ans: Apply your .yaml file with the kubectl create -f command.


9. The following is a kubectl command dealing with network policies:

Ans: --image=nginx



10. You have a Kubernetes application with multiple clusters being used. You would like to implement a way to monitor the application while also being able to visualize it with a dashboard and a means to query your data. Which would satisfy your request?

Ans: Prometheus


11. What are the 4 C’s of the Cloud Native Security paradigm?

Ans: Code, Container, Cluster, Cloud


12. You are monitoring your application and then you step away from it for one hour. When you come back you see that something has gone wrong with one of your clusters. What can you do to find out what happened during this hour?

Ans: kubectl logs --since=1h <podname>


13. What is a binary file?

Ans:  A non-text file


14. You need to expose the single Service with an Ingress named test-ingress by specifying a default backend with no rules using the kubectl apply -f command. How can you view the state of the Ingress you just added?

Ans:  kubectl get ingress test-ingress


15. What language is the Kubernetes end-to-end testing framework written in?

Ans:Go


16. Inside a cluster, which command can list the service in the cluster?

Ans: kubectl get service dns-backend


17. How can you take a back up snapshot using the built-in snapshot method supported by etcd?

Ans:  By using the etcdctl snapshot save command.


18. Which Kubernetes object allows decoupling of an app's configuration from a Pod's specification?

Ans: ConfigMap

19. What is the load balancer in Kubernetes?

Ans: One of the most common services to expose the service in Kubernetes , there are 2 types of the load balancer 

Internal load balancer: this will manage the incoming load 

External Load balancer: This will manage the external load and direct that load to backend pods.

20. What are the main benefits that Deployments offer that Replication Controllers do not?

Ans:  Strong update and roll-back model.

21. How to validate the cluster in Kubernetes?

Ans: Kubeadm validate cluster

22. Kubeadm command to create cluster?

Ans: kubeadm init 

23. you are deploying tightly coupled containers that share the same volume and memory?

Ans: deploy the containers in the same pod

24. Command to get the detailed info?

Ans: kubectl describe pods

25. which component of K8s will register the node with cluster and wait for API server inputs?

Ans: Kubelet 

26. What is the default service type?

Ans: ClusterIP

27. What is the default protocol in the Kubernetes service?

Ans: TCP

28. Will containers share the same IP address in POD?

Ans: yes

29. How to deploy a pod in a particular node? 

Ans: Node affinity and node selector, you can deploy the pod in a particular node

30. What is headless service?

Ans: A Headless service is used to interface with the service discovery mechanism without being tied to the cluster. IP.





No comments:

Post a Comment