Full lesson
Explore the full explanation, examples, and visuals at your own pace.
Searching for a restart command
There's no restart command for a Pod. You updated a config value your app reads only at startup, so you typed kubectl restart pod, and got an unknown command error. A Pod, remember, is just one running copy of your app.
$ kubectl restart pod your-app-7d9f
error: unknown command "restart" for "kubectl"Traffic keeps flowing at every step
Kubernetes doesn't restart a Pod. It replaces it. A Deployment, the controller that manages your Pods, starts from three old Pods, swaps one for a new Pod, then another, until all three are new. By default, the remaining Pods keep serving traffic throughout.
The fix
Run kubectl rollout restart, then deployment slash your-app. You're not touching a Pod. You're telling the Deployment to swap its Pods for fresh ones, gradually. The new Pods read your updated startup data, and the app stays up while it happens.
$ kubectl rollout restart deployment/your-app
deployment.apps/your-app restartedKubernetes doesn't restart your app. It replaces it.
To refresh your Pods, ask the Deployment with rollout restart. Kubernetes doesn't restart your app. It replaces it.