[{"id":"kubernetesadvanced-001","courseId":"kubernetes-advanced","domain":"workloads","topic":"Pod termination with SIGTERM and grace period","prompt":"A Pod has a preStop hook and no sidecars. You delete it with the default 30-second grace period. Put these shutdown steps in the order the cluster performs them.","hint":"Think about what happens the moment the delete request arrives.","explain":"Deleting a Pod is a handshake between the API server and the node running it. Containers get a time budget to exit cleanly before anything is forced to stop.","source":"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination","interaction":{"type":"sort","items":[{"text":"The API server records a deadline and grace period on the Pod.","why":"Deletion begins in the API, which only marks the Pod with a deadline rather than removing it at once."},{"text":"The kubelet sees the Pod is terminating and starts local shutdown.","why":"Node-side shutdown can only start once the kubelet has seen the Pod marked as terminating."},{"text":"The kubelet runs the container's preStop hook, if one is defined.","why":"The hook runs before any TERM signal, so it can finish work while the process is still alive."},{"text":"The runtime sends TERM to process 1 in each container.","why":"TERM follows the hook, giving the app a graceful signal to exit on its own."},{"text":"When the grace period expires, the runtime sends SIGKILL to what is left.","why":"SIGKILL is the forced last resort, sent only after the grace period has run out."}]},"options":[],"answer":"o:abcde","explanation":"Pod deletion is graceful: the API marks the Pod, the kubelet runs preStop and then sends TERM, and SIGKILL follows only when the grace period expires.","concept":"Pod deletion is graceful: the API marks the Pod, the kubelet runs preStop and then sends TERM, and SIGKILL follows only when the grace period expires.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["The grace period covers the preStop hook and the wait for exit; SIGKILL comes only after it expires."]},{"id":"kubernetesadvanced-002","courseId":"kubernetes-advanced","domain":"workloads","topic":"Ephemeral containers for troubleshooting","prompt":"You can add an ephemeral container to a running Pod by running kubectl edit on the Pod and adding the container under its spec.containers.","hint":"Think about which part of the API ephemeral containers are created through.","explain":"Ephemeral containers are temporary containers you add to a running Pod to inspect it, not to run an application. A Pod's containers are normally fixed once it has been created.","source":"https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"Ephemeral containers are not added to pod.spec at all, so an edit under spec.containers never creates one."},{"id":"b","text":"False","why":"They are created through a special ephemeralcontainers API handler, and it is not possible to add one with kubectl edit."}],"answer":"b","explanation":"Ephemeral containers are created through the Pod's ephemeralcontainers API handler rather than pod.spec, and once added they cannot be changed or removed.","concept":"Ephemeral containers are created through the Pod's ephemeralcontainers API handler rather than pod.spec, and once added they cannot be changed or removed.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Ephemeral containers are for inspection, are never restarted automatically, and cannot be added with kubectl edit."]},{"id":"kubernetesadvanced-003","courseId":"kubernetes-advanced","domain":"workloads","topic":"StatefulSet update strategies","prompt":"A StatefulSet has 5 replicas and a rollingUpdate partition of 3. You change the Pod template, then delete web-1 by hand. Which template revision does the new web-1 run?","hint":"Look at how the partition treats Pods whose ordinal is below it.","explain":"A StatefulSet can roll out a change to only some of its Pods, using an ordinal cutoff. Pods have stable, numbered identities, so the controller can treat low and high ordinals differently.","source":"https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies","interaction":{"type":"single"},"options":[{"id":"a","text":"The previous template revision","why":"Pods below the partition are not updated, and even when deleted they are recreated at the previous revision."},{"id":"b","text":"The new template revision","whyNot":"Deleted Pods are not always rebuilt from the current template; below the partition they return at the old revision."},{"id":"c","text":"The new revision, after web-4 has been updated","whyNot":"Updates run from the largest ordinal down, but web-1 sits below the partition, so waiting on web-4 does not change its revision."},{"id":"d","text":"No revision; it stays absent until the partition is lowered","whyNot":"The controller does recreate the Pod at the previous revision, so it does not stay deleted."}],"answer":"a","explanation":"With a rollingUpdate partition, Pods with ordinals below it keep the old revision, and a deleted one is recreated at that old revision.","concept":"With a rollingUpdate partition, Pods with ordinals below it keep the old revision, and a deleted one is recreated at that old revision.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"spec:\n  replicas: 5\n  updateStrategy:\n    type: RollingUpdate\n    rollingUpdate:\n      partition: 3","takeaways":["A partition stages a rollout: Pods below it stay on the old revision, even after they are deleted."]},{"id":"kubernetesadvanced-004","courseId":"kubernetes-advanced","domain":"workloads","topic":"Deployment revision history limit","prompt":"A Deployment sets spec.revisionHistoryLimit to 0. Which TWO statements about this Deployment's revisions are true?","hint":"Think about where old revisions are stored and what the limit removes.","explain":"A Deployment keeps its old ReplicaSets so it can roll back, and a setting controls how many are retained. The cleanup does not happen at every moment; it depends on the Deployment's state.","source":"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#clean-up-policy","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"Old ReplicaSets are removed, so the Deployment cannot roll back to them","why":"Setting the limit to 0 cleans up all history, and without old ReplicaSets there is nothing to roll back to."},{"id":"b","text":"A new rollout creates a new ReplicaSet before the old one is removed","why":"Even with 0, a rollout first creates the new ReplicaSet; the old one is removed only afterwards."},{"id":"c","text":"Rollouts stop creating ReplicaSets, so there is nothing to clean up","whyNot":"Every rollout still creates a new ReplicaSet, even when the history limit is 0."},{"id":"d","text":"The default of 10 old ReplicaSets is kept anyway, since 0 is ignored","whyNot":"Setting 0 explicitly cleans up all history; the default of 10 is not kept in its place."},{"id":"e","text":"Cleanup runs right after each rollout, even while the Deployment is still progressing","whyNot":"Cleanup starts only after the Deployment reaches a complete state, not during a rollout."},{"id":"f","text":"Revision history lives in the Deployment object, so the limit only trims entries there","whyNot":"Revision history is stored in the ReplicaSets the Deployment controls, not in the Deployment object itself."}],"answer":"ab","explanation":"revisionHistoryLimit sets how many old ReplicaSets are kept; 0 removes all rollback history, but a rollout still creates its new ReplicaSet first.","concept":"revisionHistoryLimit sets how many old ReplicaSets are kept; 0 removes all rollback history, but a rollout still creates its new ReplicaSet first.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["A revisionHistoryLimit of 0 removes all rollback history for the Deployment."]},{"id":"kubernetesadvanced-005","courseId":"kubernetes-advanced","domain":"workloads","topic":"Indexed Job completion mode","prompt":"An Indexed Job sets completions to 4. A node fails during the run, so two Pods for index 2 both finish successfully. How does the Job count them?","hint":"Think about how many successes the Job needs for each index.","explain":"An Indexed Job gives each Pod a fixed index from a set range, and the Job tracks progress against those indexes. Node failures and restarts can create extra Pods along the way.","source":"https://kubernetes.io/docs/concepts/workloads/controllers/job/#completion-mode","interaction":{"type":"single"},"options":[{"id":"a","text":"Both Pods count, so the Job finishes after five successes","whyNot":"The Job is complete once each index has one successful Pod, so a second success for index 2 adds nothing."},{"id":"b","text":"Neither counts until the node recovers and the original Pod restarts","whyNot":"A successful Pod counts as soon as it completes; the Job does not wait for a node to recover."},{"id":"c","text":"Only the first successful Pod for index 2 counts; the other is deleted","why":"Only the first Pod to succeed updates the Job's status, and the controller deletes the other Pods for that index once it detects them."},{"id":"d","text":"The second Pod takes index 4, so the Job still covers indexes 0 to 4","whyNot":"Indexes run from 0 to completions minus 1, so a duplicate Pod does not get a new index."}],"answer":"c","explanation":"In an Indexed Job, each index needs one successful Pod; if duplicates finish, only the first success counts and the others are deleted.","concept":"In an Indexed Job, each index needs one successful Pod; if duplicates finish, only the first success counts and the others are deleted.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"spec:\n  completions: 4\n  parallelism: 2\n  completionMode: Indexed","takeaways":["In an Indexed Job, the first successful Pod per index counts; later Pods for that index are deleted."]}]