Basics Flashcards
Kubernetes is composed of two separate planes:
Control Plane and Data plane
What does this statement refer to?: machines that can run containerized workloads. Each node is managed by the kubelet, an agent that receives commands from the control plane.
Kubernetes data plane
What does this statement refer to?: manages Kubernetes clusters and the workloads running on them. Include components like the API Server, Scheduler, and Controller Manager.
Kubernetes control plane
What is the smallest unit of Kubernetes?
The pod. A pod typically includes several containers, which together form a functional unit or microservice.
Why is persistent storage important?
local storage on Kubernetes nodes is ephemeral, and is deleted when a pod shuts down. This can make it difficult to run stateful applications. Kubernetes provides the Persistent Volumes (PV) mechanism, allowing containerized applications to store data beyond the lifetime of a pod or node.
________ is a database that stores information in a key value format.
ETCD Cluster
______________is a control plane process which assigns Pods to Nodes. ______________determines which Nodes are valid placements for each Pod in the scheduling queue according to constraints and available resources. _____________then ranks each valid Node and binds the Pod to a suitable Node.
The scheduler
the ____________ is responsible for orchestrating all operations within the cluster.
kube-apiserver
the ______________ is an agent that runs on each node in a cluster, it deploys or destroys containers in the node as required. It listens from instructions from the kube-apiserver.
kubelet
what does the kube-proxy do?
Its responsible for the communication between services within the cluster.
The master node is comprised by:
ETCD Cluster, kube-apiserver, kube Controller Manager and Kube-scheduler.
The worker nodes are comprised by:
the kubelet, kube-proxy and the container runtime engine.
Reminisce on Docker and Containerd history and how Kubernetes only kept docker’s daemon rather than also sticking with the other componentes like the volumes, image building features, etc:
Kubernetes used to rely on Docker to manage containers, but it only needed Docker’s container runtime, not the extra features like image building. To make things simpler, Kubernetes switched to using containerd, which is the part of Docker that actually runs containers. They removed support for Docker through something called dockershim. This change made Kubernetes faster and more efficient because it could talk directly to containerd without needing Docker in the middle.
why use nerdctl cli over ctr cli?
ctr is for debugging purposes only and its not the most user friendly tool. Contrary to nerdctl as it provides a Docker-like CLI for containerD.
what is a key value store?
a key value store stores information in the form of forms or documents. Changing one file doesnt affect the others.
True or false: every change made to the cluster is updated in the etcd server, only then, is the change considered to be complete.
True
Default port on which etcd listens
2379
What are the implications of deploying a cluster from scratch:
- You install and configure each component manually (etcd, API server, scheduler, controller manager, kubelet, kube-proxy).
- Gives complete control over the configuration.
- Requires deep knowledge of Kubernetes internals.
What are the implications of using Kubeadm for the deployment of the Cluster:
- Automated setup
- Follows best practices by default.
- Some configurations are abstracted away for simplicity.
There are two things that need to be specified when using etcdctl api (the first thing is necessary for commands to be usable and the second one is for authentication purposes):
1) Its necessary to specify api version (its possible to choose between version 2 and 3):
export ETCDCTL_API=3
2) Its necessary to specify the path where the ssl certificate is.
The only component that interacts directly with etcdserver is:
the kube-api server
What does the kube controller manager do?
It watches the API server for changes (like creating or deleting Pods) and makes sure the cluster matches the desired state.
For example, if a Pod crashes, it notices and starts a new one to replace it.
What things does the kubecontroller manager admins:
the node controller - health checks
replication controller - ensures the right number of read replicas are runnning.
endpoint controller - updates endpoints objects when services or pods change.
service account & token controllers - manages service accounts and their access tokens.
What is the node monitor period?
5 seconds
what are kubernetes services?
Virtual components thaet reside within kubernetes engine
Talk about Networking in Kubernetes
Pod communication - Pods can communicate across nodes without NAT using a flat network space.
Service Discovery - Services provide stable IPs and DNS names for pods, enabling easy discovery.
Network Policies - Control traffic flow between pods.
kube-proxy’s Role when it comes to service routing, operating modes and load balancing:
Service Routing: Manages network rules to direct traffic to the right pods by watching changes in Services and Endpoints.
The operating modes are: ip-tables which are fast and scalable, ipvs (this is robust load balancing using Linux virtual Server) and lastly Userspace, which is a legacy mode, less common.
Load Balancing: distributes requests evenly across pod replicas.
What is a pod?
the containers are encapsulated in pods, a pod is a single instance of an application and the smallest object that you can create in Kubernetes.
Are we limited to having a single container within a pod?
NO. However, when it comes to scaling the application, its best to have multiple nodes.
Kubernetes uses _______ files to define resources like Pods, Services and Deployments in a structured human-readable format.
YAML
Regarding the key components of the Kubernetes YAML file:
what does the apiVersion do?
specifies the Kubernetes API version.
Regarding the key components of the Kubernetes YAML file: the ______ defines the resource type (eg. Pod, Service, Deployment)
kind
Regarding the key components of the Kubernetes YAML file: _______ contains the resource’s name, labels, and namespace.
metadata
Regarding the key components of the Kubernetes YAML file: ________ describes the desired estate, such as container images, replicas, or networking rules.
spec
about the Kubernetes cheat sheet:
create pods with given image: kubectl run nginx –image=nginx
create pods from yaml file: kubectl create -f pods.yaml
get pods: kubectl get pods
get specific pod: kubectl get pods/webapp
describe a pod: kubectl describe pods
discover where nodes are placed: kubectl get pods -o wide
Using the dry run option:
eg.
kubectl run redis –image=redis123 –dry-run -o yaml
kubectl run redis –image=redis123 –dry-run=client -o yaml > redis.yaml
kubectl
Apply changes made into a yaml file:
kubectl apply -f redis.yaml
What is the replication controller in Kubernetes?
A Kubernetes object that manages the number of copies of a pod that are running.
What’s the difference between the replication controller and the replica set in Kubernetes?
Both have the same function, the replication controller is the old technology used to manage the pod replicas, and it is being replaced by replica set.