Pods, deployments, services, ingress, troubleshooting
Practise these as flashcards. One or two lines each; the ones you miss come back first.
Start freestartupProbe in a pod specification to improve reliability for applications with slow initialization in Kubernetes 1.18+?The startupProbe lets you define custom checks for application startup, separate from liveness and readiness probes. This prevents premature restarts for apps that take longer to initialize. You specify the probe in the pod manifest, and Kubernetes will only start liveness and readiness checks after the startup probe succeeds.
I'd check for issues with service endpoints, such as missing endpoints due to pod network policies or misconfigured ServiceAccount permissions. With recent versions, I'd also verify if any CNI plugin settings or network policies are blocking traffic, and inspect the Endpoints resource to ensure pods are listed. Features like TopologyAwareHints in Services can affect routing, so I'd review those settings as well.
It runs containers across a cluster of machines. You declare what you want and it handles scheduling, restarts failed containers, scales, does rolling updates and gives services stable names. It replaces a lot of manual server and deployment work.
Control plane: the API server is the front door, etcd stores cluster state, the scheduler places pods, and controllers keep actual state matching desired state. Each worker node runs the kubelet (runs pods), kube-proxy (service networking) and a container runtime like containerd.
A container is one running process image. A pod wraps one or more containers that share network and storage. A Deployment manages a set of identical pods, keeps the count right and handles updates.
ClusterIP for internal traffic (default), NodePort to open a port on every node, LoadBalancer to get a cloud load balancer, and ExternalName to alias an outside DNS name.
Liveness failing means the container is restarted. Readiness failing means the pod is taken out of the Service so it gets no traffic, but it isn't restarted.
startupProbe in a pod specification to improve reliability for applications with slow initialization in Kubernetes 1.18+?The startupProbe lets you define custom checks for application startup, separate from liveness and readiness probes. This prevents premature restarts for apps that take longer to initialize. You specify the probe in the pod manifest, and Kubernetes will only start liveness and readiness checks after the startup probe succeeds.
kubectl logs <pod> --previous to see why the last run died, then kubectl describe pod for events like OOMKilled or a failed liveness probe. Common causes: bad config or missing secret, wrong command, app can't reach its database, memory limit too low, or a liveness probe that's too aggressive.
Wrong image name or tag, the image doesn't exist, the node can't reach the registry, or missing credentials (imagePullSecret or registry permissions). describe pod shows the exact error.
The scheduler can't place it: not enough CPU or memory for its requests, a nodeSelector or affinity no node matches, taints it doesn't tolerate, or a PVC that isn't bound. The Events in describe pod say which.
It used more memory than its limit, so the kernel killed it. Raise the limit if it's undersized, or fix the leak. Check usage with kubectl top pod.
kubectl get endpoints <svc>. If empty, the Service selector doesn't match the pod labels, or the pods aren't Ready. Also check targetPort matches the port the container listens on, and any NetworkPolicy blocking traffic.
Both inject config into pods. ConfigMaps are for plain settings. Secrets are for sensitive values, can be encrypted at rest and access-controlled separately. By default Secrets are only base64-encoded.