InterviewSolution
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. |
How to get the central logs from POD? |
|
Answer» This architecture depends upon the APPLICATION and many other factors. Following are the common logging patterns
In the SETUP, journalbeat and filebeat are running as daemonset. Logs collected by these are dumped to the kafka topic which is EVENTUALLY dumped to the ELK stack. The same can be achieved using EFK stack and fluentd-bit. |
|
| 2. |
How to monitor the Kubernetes cluster? |
|
Answer» Prometheus is USED for Kubernetes monitoring. The Prometheus ecosystem CONSISTS of multiple components. |
|
| 3. |
What are the various things that can be done to increase Kubernetes security? |
|
Answer» By DEFAULT, POD can COMMUNICATE with any other POD, we can SET up network policies to limit this COMMUNICATION between the PODs.
|
|
| 4. |
What is the role of Load Balance in Kubernetes? |
|
Answer» Load BALANCING is a way to distribute the incoming traffic into multiple backend SERVERS, which is useful to ensure the application available to the users. Load BalancerIn Kubernetes, as shown in the above figure all the incoming traffic lands to a single IP address on the load balancer which is a way to expose your service to outside the internet which routes the incoming traffic to a particular pod (via service) using an algorithm known as round-robin. Even if any pod GOES down load balances are notified so that the traffic is not routed to that particular unavailable node. THUS load balancers in Kubernetes are responsible for distributing a SET of tasks (incoming traffic) to the pods |
|
| 5. |
What’s the init container and when it can be used? |
|
Answer» init CONTAINERS will set a stage for you before running the actual POD. Wait for some time before STARTING the APP Container with a command like sleep 60. Clone a GIT repository into a volume. |
|
| 6. |
What is PDB (Pod Disruption Budget)? |
|
Answer» A Kubernetes administrator can create a deployment of a kind: PodDisruptionBudget for high availability of the application, it makes sure that the minimum NUMBER is running pods are respected as mentioned by the ATTRIBUTE minAvailable SPEC file. This is useful while performing a drain where the drain will halt until the PDB is respected to ensure the High Availability(HA) of the application. The following spec file also shows minAvailable as 2 which implies the minimum number of an AVAILABLE pod (even after the election). Example: YAML Config using minAvailable => apiVersion: policy/v1beta1kind: PodDisruptionBudgetmetadata: name: zk-pdbspec: minAvailable: 2 SELECTOR: matchLabels: app: zookeeper |
|
| 7. |
What are the various K8's services running on nodes and describe the role of each service? |
|
Answer» Mainly K8 cluster consists of two types of nodes, executor and master. Executor node: (This runs on master node)
Master services:
|
|
| 8. |
How do we control the resource usage of POD? |
|
Answer» With the use of limit and REQUEST resource usage of a POD can be controlled. Request: The number of resources being requested for a container. If a container exceeds its request for resources, it can be throttled back down to its request. Limit: An upper cap on the resources a single container can use. If it tries to exceed this predefined limit it can be terminated if K8's decides that ANOTHER container needs these resources. If you are sensitive TOWARDS pod restarts, it makes sense to have the sum of all container resource limits equal to or less than the total resource capacity for your cluster. Example: apiVersion: v1kind: Podmetadata: name: demospec: containers: - name: example1 IMAGE:example/example1 resources: REQUESTS: memory: "_Mi" cpu: "_m" limits: memory: "_Mi" cpu: "_m" |
|
| 9. |
How to do maintenance activity on the K8 node? |
|
Answer» Whenever there are security patches available the Kubernetes administrator has to perform the maintenance task to apply the security PATCH to the running container in order to prevent it from vulnerability, which is often an unavoidable part of the ADMINISTRATION. The following two commands are useful to SAFELY drain the K8s node.
The first command moves the node to maintenance mode or makes the node unavailable, FOLLOWED by kubectl drain which will finally discard the pod from the node. After the drain command is a success you can perform maintenance. Note: If you wish to perform maintenance on a single pod following two commands can be issued in order:
|
|