Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Can you explain the differences between Docker Swarm and Kubernetes?

Answer»

Below are the main difference between Kubernetes and Docker:


  • The installation procedure of the K8s is very complicated but if it is once installed then the cluster is robust. On the other hand, the Docker swarm installation process is very simple but the cluster is not at all robust.

  • Kubernetes can process the auto-scaling but the Docker swarm cannot process the auto-scaling of the pods based on incoming load.

  • Kubernetes is a full-fledged Framework. Since it maintains the cluster states more consistently so autoscaling is not as fast as Docker Swarm.


2.

How can we forward the port '8080 (container) -> 8080 (service) -> 8080 (ingress) -> 80 (browser)and how it can be done?

Answer»

The ingress is exposing port 80 externally for the browser to access, and CONNECTING to a service that listens on 8080. The ingress will LISTEN on port 80 by default. An "ingress controller" is a pod that receives external traffic and handles the ingress and is configured by an ingress resource For this you need to configure the ingress selector and if no 'ingress controller selector' is MENTIONED then no ingress controller will manage the ingress.

Simple ingress CONFIG will look like

host: abc.orghttp:paths:BACKEND:serviceName: abc-serviceservicePort: 8080Then the service will look likekind: ServiceapiVersion: v1metadata:name: abc-servicespec:ports:protocol: TCPport: 8080 # port to which the service listens totargetPort: 8080Additional Resources

Kubernetes Vs Openshift

3.

What are the different ways to provide external network connectivity to K8?

Answer»

By DEFAULT, POD should be able to reach the external network but vice-versa we NEED to make some changes. Following options are available to connect with POD from the outer world.

  • Nodeport (it will expose one port on each node to COMMUNICATE with it)
  • Load balancers (L4 layer of TCP/IP protocol)
  • Ingress (L7 layer of TCP/IP Protocol)

Another method is to use Kube-proxy which can expose a service with only cluster IP on the local system port.

$ kubectl proxy --port=8080 $ HTTP://localhost:8080/api/v1/proxy/namespaces//services/:/

4.

How to run a POD on a particular node?

Answer»

Various methods are AVAILABLE to achieve it.

  • nodeName: SPECIFY the NAME of a node in POD spec CONFIGURATION, it will try to run the POD on a specific node.
  • nodeSelector: Assign a specific label to the node which has special resources and USE the same label in POD spec so that POD will run only on that node.
  • nodeaffinities: required DuringSchedulingIgnoredDuringExecution, preferredDuringSchedulingIgnoredDuringExecution are hard and soft requirements for running the POD on specific nodes. This will be replacing nodeSelector in the future. It depends on the node labels.
5.

How to troubleshoot if the POD is not getting scheduled?

Answer»

In K8’s scheduler is responsible to SPAWN pods into nodes. There are MANY factors that can lead to unstartable POD. The most COMMON one is running out of resources, use the commands like kubectl describe <POD> -n <Namespace> to see the reason why POD is not started. Also, keep an EYE on kubectl to get events to see all events coming from the CLUSTER.

6.

What is the difference between Docker Swarm and Kubernetes?

Answer»

Below are the main difference between Kubernetes and Docker:

  • The installation procedure of the K8s is very complicated but if it is once installed then the CLUSTER is robust. On the other HAND, the Docker swarm installation process is very simple but the cluster is not at all robust.
  • Kubernetes can process the auto-scaling but the Docker swarm cannot process the auto-scaling of the pods based on INCOMING load.
  • Kubernetes is a full-fledged FRAMEWORK. Since it maintains the cluster states more consistently so autoscaling is not as fast as Docker Swarm.
7.

What the following in the Deployment configuration file mean?

Answer»

spec: containers: - name: USER_PASSWORD valueFrom: secretKeyRef: name: some-SECRET key: password

Explanation -

USER_PASSWORD environment variable will STORE the VALUE from the password key in the secret called "some-secret" In other WORDS, you reference a value from a KUBERNETES Secret.

8.

What is Kubernetes Load Balancing?

Answer»

Load Balancing is one of the most common and standard ways of exposing the services. There are two types of load balancing in K8S and they are:

INTERNAL load balancer – This type of balancer automatically balances LOADS and allocates the pods with the REQUIRED incoming load.

EXTERNAL Load Balancer – This type of balancer directs the traffic from the external loads to backend pods.

9.

How to run Kubernetes locally?

Answer»

Kubernetes can be set up locally using the Minikube tool. It runs a single-node bunch in a VM on the COMPUTER. Therefore, it offers the perfect WAY for users who have just ongoing learning Kubernetes.