Quantcast
Channel: Cloud Training Program
Viewing all articles
Browse latest Browse all 1902

[Recap] Day 7 & 8: K8s Services, Deployment, HPA, Cluster Resource Limit, Daemonset Controller and Dashboard [CKA/D] [Kubernetes Certification]

$
0
0

Loading

This blog post covers a brief overview of the topics covered and some common questions asked on Day 7 and Day 8 Live Interactive training on Docker and Kubernetes Certification i.e. CKA / CKAD .

In the Day 5 & 6 CKA/CKAD Live session we covered Introduction to Kubernetes, its Architecture, installation, Basic building blocks, Static Pod, and Kubernetes Basic Networking. And in this week, Day 7 and Day 8 we covered  Kubernetes Services, Deployment, HPA, Cluster Resource Limit, Daemonset Controller and Dashboard. 

We also covered hands-on Lab 14Lab 15Lab 16Lab 17 Lab 22 & Lab 24 out of our 30+ extensive labs.

Know everything about the CKA Certification

Here are some of the Q/A’s asked during the Live session:

Kubernetes Deployment

A Kubernetes Deployment instructs Kubernetes on how to build or change instances of the pods that comprise a containerized application. Deployments can expand the number of replica pods, enabling controlled distribution of new code, or roll back to an older deployment version if necessary.

deployment

A Deployment owns and manages one or more ReplicaSets. And Replica Set manages the basic units in Kubernetes – Pods.

There a few more important features of a Kubernetes Deployment that one needs to know for the best utilization.

  • Multiple Replicas: Multiple replicas of pods are created for high availability and load balancing with the help of deployment. By default, one count of Replicas is created by K8s, even if you don’t specify it. Thus, it makes sure that the required number of instances are running all the time and the new pod will be spun up in no time.
  • Upgrade: The major benefit of using Deployment to control your pods is the ability to perform rolling updates. The rolling update allows you to update the configuration of the pods gradually, and Deployments offer numerous options to control this process.
  • Rollback: Rollback Deployment is going back to the previous instance of the deployment if there is some issue with the current or new deployment.
  • Scaling: The number of pods running should be dependent on the traffic. For this purpose scale up and scale down strategies are defined in the deployment manifest.

↦ Read more about the Kubernetes deployment

Q) What are the types of service in Kubernetes?

Ans: A Kubernetes Service is a logical abstraction for a deployed group of pods in a cluster. Pods are ephemeral a service that enables a group pod, which provide specific functions to assign a name and a unique IP address.

  • ClusterIP – Expose a service that can only be accessed within the cluster.
  • NodePort – Exposes a service via a static port on each node’s IP.
  • LoadBalancer – Exposes the service via the cloud provider’s load balancer.
  • ExternalName – Maps service to a predefined externalName field by returning a value for the CNAME record

↦ Read more about the Kubernetes Services

service

Q) What is the difference between deployment and service?

Ans: A deployment is a method of launching a pod with containerized application and ensuring the desired number of replicas is always running in the cluster. A service is responsible for exposing an interface to the pod. which is used to access networks within-cluster or between external services and processes.

Q) What is Istio?

Ans: Istio is a service mesh. It was developed by Google in collaboration with IBM and Lyft. It is a modernized service networking layer that provides a transparent and language-independent way to automate application network functions. It is used to manage different microservices that make up the cloud-native application

Istio

Q) What is the use of the controller manager?

Ans: Kubernetes controller manager takes care of the running cluster. It consists of several controllers functions and manages as one. The controller checks with the scheduler and makes sure the correct number of pods are running. If any pods go down controllers respond. It can also be used to connect services to pods.

architecture

Q)What are selectors and labels

Ans:

Labels are key-value that are attached to pods, replication controllers and services. Labels are used to identify attributes objects like pods and replication controllers. It can be added at object creation time and can be modified at run time.

Selectors are core grouping primitive in Kubernetes.it is used to select a set of objects labels.

↦ Read more about the Kubernetes labels and selectors

5

Q) What is the use of ReplicaSet?

Ans: A replica set ensures the guaranteed number of pods replicas are running at a time. A replica set is defined using fields with selectors it specifies how to identify pods it can acquire and the number of replicas indicating how many pods it should be maintaining and it also has a template. When a replica set needs to create new pods it uses its pod template.

6

Introduction to HPA and Kubernetes Networking

Q) What is HPA

Ans: HPA or Horizontal Pod Autoscalar is a mechanism available in Kubernetes to scale the number of pods in a replication controller, deployment, replica set, stateful set or a set of them, based on observed usage of CPU, Memory, or using custom-metrics.It works as a control loop when ever required metric is less or more than the threshold we declared. it will automatically scale up or scale down resources automatically.

Configuring Auto-scaling with HPA

Based on observed CPU use, the Horizontal Pod Auto-scaler automatically scales the number of Pods in a replication controller, deployment, replica set, or stateful set.

Q) What is Horizontal v/s Vertical AutoScaler?

Ans: Horizontal scaling means increasing its Running instance.It can be like adding new nodes to a cluster or increasing the number of pods by the replica count. Vertical Scaling means increasing the resources of nodes in a cluster. It will increase the capacity of the existing nodes by adding more resources(like CPU or Memory).

↦ Read more about the high availability in Kubernetes

Q) Do we have Vertical scaling also available with Kubernetes?

Ans: Yes

Q) What Kubernetes metric Server?

Ans: Metric server is used to measure resource usage across clusters. Kubernetes metric server collects resource metrics from the kubelet running on each node and exposes them to the Kubernetes API server through the Kubernetes Metrics API.

7

Deploy and Update Daemonset Controller

DaemonSet ensures that all (or some) Nodes run a copy of a Pod. As nodes are added to the cluster, Pods are added to them. As nodes are removed from the cluster, those Pods are garbage collected. Deleting a DaemonSet will clean up the Pods it created.

Some typical uses of a DaemonSet are:

  • running a cluster storage daemon on every node
  • running a logs collection daemon on every node
  • running a node monitoring daemon on every node

In a simple case, one DaemonSet, covering all nodes, would be used for each type of daemon. A more complex setup might use multiple DaemonSets for a single type of daemon, but with different flags and/or different memory and cpu requests for different hardware types.

Q) How to work with Daemonsets?

Ans: A DaemonSet is an active Kubernetes object managed by a controller. You can declare your desired state, indicating that a specific Pod needs to be present on every node. The reconciliation control loop is going to compare the desired state with the current observed state. If an observed node does not have a matching Pod, the DaemonSet controller is going to create one automatically.

This automated process includes existing nodes and all newly created nodes. The Pods created by DaemonSet controllers are ignored by the Kubernetes scheduler and exist as long as the node itself.

A DaemonSet creates a Pod on every node by default. If necessary, you can limit the number of acceptable nodes by using a node selector. The DaemonSet controller is going to create Pods only on nodes that match the predefined nodeSelector field in the YAML file.

↦ Read more about the Kubernetes Daemonsets

Kubernetes Dashboard

The web-based Kubernetes console, which is a general-purpose UI made to look after the Cluster in Kubernetes. Surprisingly, even the dashboard is nothing but a container that access the cluster inform from within the cluster. So, it’s just another resource for Kubernetes to manage.

It is used for deploying containerized applications as well as for general cluster resource management. As mentioned before it is very useful to have a visual representation of our cluster in a user-friendly interface.

 

9

Q) What does the Kubernetes dashboard do?

Here are the things you can do with the Kubernetes dashboard:

  • You will get an overview of applications running on your cluster.
  • To create or modify the individual Kubernetes resources for example Deployments, Jobs, etc.
  • It provides the information on the state of Kubernetes resources in your cluster, and on any errors that may have occurred.

↦ Read more about the Kubernetes Dashboard

Cluster Resource Limit (Resource Quota)

Requests and limits are mechanisms that Kubernetes uses to control resources such as CPU and memory. The request is guaranteed by the container. If a container requests a resource, Kubernetes will only schedule it on the nodes that can provide it. On the other hand, the constraints ensure that the container never exceeds a certain value. The container can only go up to the limit and then it is restricted.

If a container requests a resource, Kubernetes will only schedule it on a node that can give it that resource. Limits, on the other hand, make sure a container never goes above a certain value. The container is only allowed to go up to the limit, and then it is restricted.

Quiz Time (Sample Exam Questions)!

With CKA training program, we are going to cover 100+ sample exam questions to help you prepare for CKA certification. Check out the questions and see if you can solve this.

Here is the answer to the question shared last week

Ques) Which of the following runs on each node and ensures containers are running in a pod?

A. Pod

B. Etcd

C. Kubelet

D. All of the above

Answer: C

Explanation: Kubelet is a agent runs on each node and ensures containers are running in a pod.

Ques) To create a new deployment in kubernetes which command you will use from the following options?

A. Kubectl run

B. Kubernetes get deployment

C. Kubernetes set deployment

D. None of the above

Write down the right answer in the comment box. The right answer will be revealed in my next week’s blog.

Related/References

Join FREE Masterclass

Discover the Power of Kubernetes, Docker & DevOps – Join Our Free Masterclass. Unlock the secrets of Kubernetes, Docker, and DevOps in our exclusive, no-cost masterclass. Take the first step towards building highly sought-after skills and securing lucrative job opportunities. Click on the below image to Register for Our FREE Masterclass Now!

Mastering Kubernetes Docker & DevOps

The post [Recap] Day 7 & 8: K8s Services, Deployment, HPA, Cluster Resource Limit, Daemonset Controller and Dashboard [CKA/D] [Kubernetes Certification] appeared first on Cloud Training Program.


Viewing all articles
Browse latest Browse all 1902

Trending Articles