Kubernetes Probes Flashcards
What are Kubernetes Probes?
Kubernetes Probes are mechanisms used to check the health and responsiveness of containers running within pods in a Kubernetes cluster.
What are the three types of Kubernetes probes?
he three types of Kubernetes probes are:
Startup Probe: Determines when a container has started and is ready to accept traffic.
Readiness Probe: Checks if a container is ready to accept traffic and should be used to avoid sending traffic to a container before it’s fully prepared.
Liveness Probe: Ensures that a container is still running and can restart the container if it becomes unresponsive.
How can probes be configured in a Kubernetes pod?
Probes can be configured in a Kubernetes pod by specifying them in the pod’s YAML configuration. You define the probe type, the command or action to execute, initial delay seconds, period seconds, and failure thresholds.
What is the purpose of the Liveness Probe?
The Liveness Probe is used to check if a container is still running and functioning correctly. If the liveness probe fails, Kubernetes will restart the container.
How does Kubernetes perform probing actions?
Kubernetes can perform probing actions in three ways: using the exec action to run a command inside the container, using the tcpSocket action to check if a TCP socket port is open, or using the httpGet action to make an HTTP GET request.
Liveness Probe Example
apiVersion: v1
kind: Pod
metadata:
name: liveness-pod
spec:
containers:
- name: my-container
image: my-image:latest
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
In this example:
We define a pod named liveness-pod with a single container named my-container using a specific Docker image (my-image:latest).
The Liveness Probe is configured with an HTTP GET action. It checks the /healthz path on port 8080 of the container.
initialDelaySeconds is set to 15, which means Kubernetes will wait for 15 seconds after the container starts before performing the first liveness probe.
periodSeconds is set to 20, indicating that Kubernetes will check the liveness of the container every 20 seconds.
This configuration ensures that Kubernetes checks the /healthz endpoint of the container every 20 seconds, starting 15 seconds after the container has started. If the probe fails, Kubernetes will restart the container.
Kubernetes Dashboards
Kubernetes Dashboards are web-based or desktop user interfaces that provide graphical representations and management capabilities for Kubernetes clusters. They allow users to visualize, monitor, and manage containerized applications, pods, services, deployments, and other resources within a Kubernetes cluster. Popular Kubernetes dashboards include the official Kubernetes Dashboard, Lens, and K9s, each offering unique features and interfaces for cluster administration.
What is a Kubernetes StatefulSet?
A Kubernetes StatefulSet is a resource object used for managing stateful applications. It ensures that pods are deployed and scaled in a predictable and ordered manner, with stable network identities and persistent storage.
What is Lens?
Lens is a free, open-source desktop application used for managing Kubernetes clusters. It provides a user-friendly graphical interface for interacting with Kubernetes clusters, viewing resources, editing YAML manifests, and performing various Kubernetes-related tasks.
What platforms is Lens available on?
Lens is available on Windows, macOS, and Linux, making it accessible to a wide range of users across different operating systems.
How does Lens connect to Kubernetes clusters?
Lens connects to Kubernetes clusters by utilizing the kubeconfig file, which contains cluster authentication information. Users can select and connect to clusters from their kubeconfig files within the Lens application.
What features does Lens offer for Kubernetes management?
Lens offers various features for Kubernetes management, including cluster visualization, resource monitoring, integrated terminal, YAML editing with syntax highlighting and validation, Helm chart support, cluster-wide search, and more.
How does Lens assist with managing Kubernetes resources?
Lens provides a visual representation of Kubernetes resources within clusters, allowing users to view pods, services, deployments, stateful sets, and other objects. It simplifies resource management by offering an intuitive interface for creating, editing, and monitoring Kubernetes resources.
Can Lens be used to manage multiple Kubernetes clusters?
Yes, Lens supports the management of multiple Kubernetes clusters. Users can switch between different clusters and contexts within the application, making it suitable for managing complex multi-cluster environments.
Is Lens suitable for both beginners and experienced Kubernetes users?
Yes, Lens is designed to cater to both beginners and experienced Kubernetes users. Its user-friendly interface makes it accessible to newcomers, while its advanced features and capabilities are valuable for experienced Kubernetes administrators.