Class 2 - Kubernetes Architecture Flashcards

1
Q

Which are the primary components of Kubernetes architecture?

A

Kubernetes Master
Kubernetes Worker

— details —

1/ There are four components of a master node.

  • Kube API server
  • controller
  • scheduler
  • etcd

2/ The worker node has three components.

  • kubelet
  • kube-proxy
  • container runtime
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What elements does Kubernetes Master have?

A

etcd
2 types of kube-controller-mananger
kube-api-server
kube-scheduler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What elements does Kubernetes nodes have?

A

kubelet
kube-proxy
container engine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is master node?

A

It is the control plane of entire k8s architecuture. It takes all the decisions. Can be configured on standalone machine. Multiple master are configured in cluster for highly available environment.
As best practice don’t run user container on master node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Responsibilities of master node?

A
  • Scheduling a pod
  • Responding to cluster events
  • Detecting pods
  • Exposing API
  • Controlling and Provisioning
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Use of master node components?

A

1) Cloud Controller Manager
Cloud controller manager is not used by end users like us, but is used by cloud providers which enables them to create VM and load balancer instances in case of managed Kubernetes service. When you create a node, it also creates underlying GCP VM instance and load balancer as well. We may work with cloud controller manager if we are making in house cloud. So in normal situations we will always install kube-controller-manager.

2) Kube Controller Manager
Controller manager takes care of maintaining the state of the cluster. If one replica goes down, then it will bring it up back again. It also controls the worker nodes. So management of pods, management of nodes, management of endpoints (IPs) so that they don’t change until the node is deleted.

3) Kube Scheduler
It manages assignment of worker node to corresponding pod. Suppose you are creating DB container which has requirement of 4CPU and 10 GB memory. Now you might have different configuration nodes. Scheduler will figure out where the resource requirement can be met.
It uses ranking algorithm that gives rank to nodes and based on that node is chosen.

4) etcd Key-Value store
etcd is a data store. It is datastore of k8s. etcd is a highly available datastore. It uses distributed locking for high availability and replication. Datastore stores data in form of key value pair.

5) Kube API server
It acts as the front end to the master node. It is at the outside facing edge. Is a way by which Kubernetes exposes a set of APIs. 
/api
/metrics
/healthz
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which are two options to interact with Kubernetes cluster i.e. API server?

A

Either use curl commands to send requests to Kube-API-Server, but that is not feasible for end user to remember all APIs.
Other option is to use “kubectl” it is CLI to interact with Kubernetes cluster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Who communicates with API server?

A

kubectl and worker nodes communicate with API server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How many ports does etcd expose?

A

etcd uses 2 ports.
etcd cluster internally uses 2379 port
etcd exposes 2380 port for external world.
So kube-api-server will communicate with etcd using 2380 port.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Does Kubernetes provide autoscaling of worker nodes?

A

No, autoscaling of nodes is not provided by Kubernetes. But autoscaling of pods is very much part of Kubernetes. While a lot of cloud providers do provide autoscaling of nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Use of worker node components?

A

1) kubelet
Is Agent service that runs on each and every worker node.
It gathers information about health of the nodes and will send information to API server.
It is the entity which creates pods on nodes.
Api server will extract information from spec section in YAML file and will send it to kubelet.
Its the kubelet’s responsibility to download the image and creating the container and running the container and reporting any issues that happen as part of pod lifecycle. Entire lifecycle of pod is reposnsibilty of kubelet.

2) kube-proxy
In kubernetes when you want to expose the pod to other containers or external world. You can’t do it directly. For that we have to create a service resource which has an external IP or port mapping like in case of docker. Then when the service resource receives request, it has to be mapped back to the pod. This is exactly what the use of kube-proxy is. It does TCP and UDP packet forwarding and once service can have multiple pods underneath for high availability.
Service can also load balance between multiple pods.

3) Container engine
This is what will actually run your containers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does kubelet work on top of, or depend on?

A

Kubelet works on top of pod spec. It creates and manages the pods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Kubernetes uses https encrypted traffic for internal communication. Which certificate will you use self signed or CA authority?

A

We must only use self signed certificate, when we want to use it for internal cluster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is kubeadm?

A

kubeadm helps you bootstrap a minimum viable Kubernetes cluster that conforms to best practices. With kubeadm, your cluster should pass Kubernetes Conformance tests. Kubeadm also supports other cluster lifecycle functions, such as upgrades, downgrade, and managing bootstrap tokens.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How kubeadm installs Kubernetes? How it treats master and workers?

A

kubeadm installs worker components kube-proxy and kubelet and docker on all the instances. kubeadm will install master components api-server, controller-manager as pods. So it requires kubelet which has the responsibility of creating the pods on the master node as well.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is CNI?

A

CNI stands for Container Network Interface which is needed by Kubernetes to create overlay network across all nodes in cluster.

17
Q

What are namespaces in Kubernetes?

A

Namespaces are like logical partitions in kubernetes. For example you have project, then group of pods can be bundled together in a namespace. Suppose you are working with client A, then you will create a namespace for client A and all applications for client A are created within that namespace. So they are logical partitions.

4 namespaces are created by Kubernetes

  • default (without any namespace, then default be chosen)
  • kube-system (by K8s to run system components)
  • kube-node-lease
  • kube-public
18
Q

Command to view all namespaces

A

kubectl get ns

19
Q

Command to view all pods in all namespaces

A

kubectl get pods –all-namespaces

20
Q

Command to view all pods in particular namespace

A

kubectl get pods -n

21
Q

Where are the pods created? Master node or worker nodes?

A

By default pods are only created on worker nodes.

22
Q

Command to view nodes in Kubernetes cluster?

A

kubectl get nodes

23
Q

Command to view detailed information of pods like IP etc

A

kubectl get pods -o wide