Kodekloud CKA class Flashcards
What two Kubernetes services run on worker nodes, and what do they do? consider updating as we learn.
kubelet: listens to instructions from the kube-api and manages the nodes containers.
Kube-Proxy: A network proxy that runs on each node that maintains network rules on each nde.
What is the CRI?
Container Runtime Interface : Container runtimes such as Docker, CRD, RKT. Docker continued to work with dockershim. while the other CRIs followed the standardized spec. Containerd seems to be where everything is going. in 1.24 the dockershim was removed.
What is containerd?
Containerd is an industry-standard container runtime with an emphasis on simplicity, robustness, and portability. It is designed to manage the complete container lifecycle of its host system, including image transfer and storage, container execution and supervision, and low-level storage and network attachments. Containerd is part of the Cloud Native Computing Foundation and serves as the core container runtime for Kubernetes.
what is the containerd ‘ctr’ command?
ctr is a command-line interface tool provided by containerd for interacting directly with the containerd daemon, primarily used for debugging and testing. The top three uses include managing container lifecycles (create, start, stop, and delete containers), pulling and pushing images, and directly interacting with the containerd API for low-level operations.
how do i pull and run an image with the containerd ctr command?
ctr images pull docker.io/library/redis:alpine
ctr run docker.io/library/redis:alpine redis
nerdctl is the better alternative to ctr for containerd. why is nerdctl better?
Nerdctl supports a wide range of Docker CLI commands, making it easier for users to transition from Docker to containerd without changing their workflows. It includes high-level features such as building images, composing multi-container applications, and managing volumes and networks, which are not directly available or as accessible in ctr.
nerdctl replaces the docker command in containerd. How do i create a container with nerdctl? how do expose ports with nerdctl.
Docker and nerdctl are pretty much identical. so nerdctl would be.
nerdctl run –name redis redis:alpine
nerdctl run –name webserver -p 80:80 -d nginx
what is crictl?
crictl is kubernetes command that allows to to control your container runtimes. used to inspect and debug contain runtimes.
crictl, which is a kubernetes command, is used to interact with the CRI. what crictl command will view the logs? How would pods be listed?
crictl logs LOGID
crictl pods
What is ETCD in Kubernetes?
etcd is a distributed key-value store that serves as the backbone for storing and managing the critical data of a Kubernetes cluster, ensuring consistency and reliability across the cluster state. It plays a pivotal role in Kubernetes for configuration data, state management, and coordination of distributed system operations, acting as the single source of truth for the cluster.
ETCD: what is a key value store?
ETCD is a database that stores data as a key:value. Each individual gets a file and there will be a key and a value. In kubernetes the KEY is the file name and the value is the data. it stores the file info in JSON.
what port does ETCD operate on?
TCP/2379
What is etcdctl and how do we retrieve a key value with it?
etcdctl is how we interact with etcd. ./etcdctl get key1 - command will return the value of the key1. in the key-value database.
what does this do: etcdctl get <key> [--prefix]</key>
Description: Retrieves the value of the specified key. If –prefix is used, it fetches all keys with the specified prefix.
Command: etcdctl put mykey “this is my key”
Description: Sets the value for a specified key. This command is used to create or update the value of a key in etcd.
Command: etcdctl del <key> [--prefix]</key>
Description: Deletes a specified key or, when used with –prefix, deletes keys with the specified prefix. It’s crucial for managing and cleaning up data in etcd.
how: Save a snapshot of the etcd database to a specified filename. This is vital for backing up etcd data.
etcdctl snapshot save myEtcd-backup-file.db
what is the command to: List all members in the etcd cluster. This command is essential for monitoring and managing the etcd cluster membership.
etcdctl member list
What is the etcdctl command to get all of the keys in the etcd db?
ETCDCTL_API=3 etcdctl get “” –prefix –keys-only
removing the –keys-only will also return values.
what does this command do: export ETCDCTL_API=3
sets the environment variable to tell etcdctl to use API version 3.
What is the process of the Kube-API when sending a request to create a new pod?
Memory hint: A.V.R.U.S.K.
- Authenticate User: Verify the identity of the user or service making the request, ensuring they are authorized to perform the action.
- Validate Request: Check the request for correctness and ensure it contains all necessary information for creating a pod.
- Retrieve Data: Fetch necessary data from etcd that might be required for processing the request, such as existing configuration or state.
- Update etcd: Persist the new pod’s specification in etcd to update the cluster’s desired state, ensuring consistency across the system.
- Scheduler: The scheduler detects the new pod creation request from the updated state in etcd and selects an appropriate node for the pod to run on, based on resource requirements, constraints, and policies.
- Kubelet: The kubelet on the chosen node is informed about the new pod and takes responsibility for creating and starting the pod’s containers according to the specified configuration.
Question: What is the Kube Controller Manager?
Answer: The Kube Controller Manager is a component of Kubernetes that runs various controller processes. . All of the controllers are bundled under this.
Question: What does the ReplicaSet Controller do?
Answer: Ensures the specified number of replicas for a pod are running at any given time, providing redundancy and scalability.
What is the purpose of the Deployment Controller?
The deployment controller manages the deployment of ReplicaSets and enables declarative updates of Pods, along with features like rollbacks and scaling.
Question: What does the StatefulSet Controller manage?
Answer: Provides unique identities to Pods, manages the deployment and scaling of a set of Pods, and ensures the proper handling of persistent storage.
Question: What is the DaemonSet Controller’s role?
Answer: Ensures that all (or some) Nodes run a copy of a specified Pod, useful for deploying system-wide daemons on every Node.
Question: What does the Job Controller do?
Answer: Manages Jobs that run Pods to completion (i.e., until a specified number of them successfully terminate).
Question: What is the function of the CronJob Controller?
Answer: Manages time-based Jobs, similar to cron in Unix-like systems, scheduling tasks to run at specific times.
Question: What responsibilities does the Node Controller have?
Answer: Notices and responds to node failures, including evicting pods from the failed nodes to maintain cluster health.
Question: What does the Service Controller manage?
Answer: Handles network rules on the cloud provider or local machine to expose services outside the cluster.
Question: What is the role of the Endpoints Controller?
Answer: Populates the Endpoints object, effectively joining Services and Pods for network communication.
Question: What does the Namespace Controller do?
Answer: Manages the lifecycle of namespaces, ensuring resources are properly cleaned up when a namespace is deleted.
Question: What is the purpose of the PersistentVolume Controller?
Answer: Manages the lifecycle, provisioning, and binding of PersistentVolumes and PersistentVolumeClaims for storage management.
Question: What does the Horizontal Pod Autoscaler (HPA) Controller manage?
Answer: Automatically scales the number of Pods in a replication controller, deployment, replica set, or stateful set based on observed CPU utilization or custom metrics.
what path and file contains the kube controller manager config/YAML file?
/etc/kubernetes/manifests/kube-controller-manager.yaml. This is where you configure your controllers.
Question: What does the command ps -aux | grep kube-controller-manager do?
Answer: This command searches for and displays information about the kube-controller-manager process running on a Linux system. ps -aux lists all running processes with detailed information, and grep kube-controller-manager filters this list to show only the processes related to the Kubernetes Controller Manager. It’s useful for checking if the kube-controller-manager is running and to see its process details like PID, CPU, and memory usage.
Question: What does the Kube Scheduler do and how does it work?
Answer: The Kube Scheduler is responsible for assigning newly created pods to nodes within the Kubernetes cluster. It works by evaluating the requirements of each pod, such as resource requirements, affinity/anti-affinity specifications, taints and tolerations, and other constraints. The scheduler then finds a suitable node that satisfies these conditions and schedules the pod to run on that node. This process ensures that pods are placed on nodes in a way that respects their scheduling requirements while also balancing the overall load across the cluster. It does not create the pod, the kubelet does that.
Where are the kube-scheduler options?
/etc/kubernetes/manifests/kube-scheduler.yaml
How do i view the kube-scheduler options, other than looking at the manifest?
ps - aux | grep kube-scheduler
Question: What does the Kubelet do?
Answer: The Kubelet is an agent that runs on each node in a Kubernetes cluster. Its primary role is to ensure that containers are running in a Pod as described in the PodSpecs. It takes a set of PodSpecs provided by the kube-apiserver and ensures that the containers described in those PodSpecs are running and healthy. The Kubelet manages the lifecycle of containers, monitors their state, and reports back to the Kubernetes control plane, contributing to the overall health and performance of the cluster.
how do i view the kubelet process and running options?
ps -aux | grep kubelet
Question: What is kube-proxy?
Answer: kube-proxy is a network proxy and load balancer that runs on each node in a Kubernetes cluster. Its main role is to maintain network rules that allow network communication to Pods from network sessions inside or outside of the cluster. kube-proxy manages the Kubernetes service abstraction by translating virtual IP addresses to Pod IP addresses, enabling service discovery and routing. It supports several modes of operation, including userspace, iptables, and IPVS, each providing different levels of performance and flexibility.
what is the kubectl command to launch an nginx pod named mynginx?
kubectl run mynginx –image nginx
What are the 4 top level fields for a pod yaml file, and what are the required definitions of those fields.
apiVersion: v1
kind: Pod
metadata:
spec:
What are the apiVersions for: Pod, Service, ReplicaSet, Deployment
KIND: VERSION:
Pod. v1
Service v1
ReplicaSet apps/v1
Deployment appls/v1