Observability Flashcards
What is the imperative command to view the current Pod status for all pods?
kubectl get po
What are Pod conditions?
Additional information related to the Pod status. Array of boolean values, as to whether Pod is Scheduled, Initialized, ContainersReady, and Pod is Ready.
What is the imperative command to view the Pod conditions for a Pod? (e.g. for Pod po1)
kubectl describe po po1
View the Conditions section
What is the purpose of the Readiness probe?
Prevents service disruption while Pods are scaled up. The Readiness probe provides kubernetes with additional information about the state of the application running in a Pod. Kubernetes can use this to determine whether to send traffic to a Pod.
What are three ways of determining readiness of a Pod?
- HTTP request to the Pod
- TCP request to the Pod
- Execute a Script within a container of the Pod
In the Pod definition, how is an HTTP readiness probe declared? (e.g. HTTP on Port 80 for path /example/path)
spec: containers - readinessProbe: httpGet: path: /example/path port: 80
In the Pod definition, how is an TCP readiness probe declared? (e.g. TCP on Port 3000)
spec: containers: - readinessProbe: tcpSocket: port: 3000
In the Pod definition, how is an executable readiness probe declared? (e.g. cat file /var/log/ready)
spec: containers: - readinessProbe: exec: command: - cat - /var/log/ready
In the Pod definition, how are initial delay and how often to repeat a readiness probe defined? (e.g. 10 seconds for initial delay and 5 seconds for repetition)
spec: containers: - readinessProbe: initialDelaySeconds: 10 periodSeconds: 5
In the Pod definition, how is the maximum number of failures of the readiness probe defined? (e.g. 3 failures)
spec: containers: - readinessProbe: failureThreshold: 3
What is the purpose of the liveness probe?
Prevents traffic being sent to a probe that is not healthy. The liveness probe provides kubernetes with additional information about the state of the application running in a Pod. Kubernetes can use this to determine whether to send traffic to a Pod.
In the Pod definition, how is an HTTP liveness probe declared? (e.g. HTTP on Port 80 for path /api/healthy)
spec containers: - livenessProbe: httpGet: path: /api/healthy port: 80
In the Pod definition, how is an TCP readiness probe declared? (e.g. TCP on Port 3001)
spec: containers: - livenessProbe: tcpSocket: port: 3001
In the Pod definition, how is an executable readiness probe declared? (e.g. cat file /var/log/healthy)
spec: containers: - livenessProbe: exec: command: - cat - /var/log/healthy
In the Pod definition, how are initial delay and how often to repeat a liveness probe defined? (e.g. 10 seconds for initial delay and 5 seconds for repetition)
spec: containers: - livenessProbe: initialDelaySeconds: 10 periodSeconds: 5
In the Pod definition, how is the maximum number of failures of the liveness probe defined? (e.g. 3 failures)
spec: containers: - livenessProbe: failureThreshold: 3
What is the imperative command for viewing logs of a Pod with a single container? (e.g. Pod po1)
kubectl logs po1
What is the imperative command for viewing logs of a Pod with multiple containers? (e.g. Container c1 of Pod po1)
kubectl logs po1 c1
What is the purpose of Metrics Server?
It provides metrics data about Kubernetes Pods and Nodes. One metrics server can be deployed per cluster. It aggregates the metrics and stores in memory.
What is one limitation of Metrics Server?
It stores data in memory, and does not provide persistence.
How does the Metrics Server work?
The cAdvisor component of Kubelet, which is installed on each node, collects metrics. Kubelet exposes these metrics through its API which Metrics Server can send requests to.
How is metrics server deployed to kubernetes?
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
What is the imperative command for viewing metrics about nodes?
kubectl top node
What is the imperative command for viewing metrics about pods?
kubectl top po