Restart an Application or a Single Pod

Restart one application, or one of its pods, without changing its configuration, using kubectl or a quick request.

This page shows how to restart one application, or one of its pods, without changing its configuration — yourself when your access allows it, and through a quick request when it does not.

When you need a restart, and when you do not

A restart helps when an application is unhealthy but its configuration is
correct, or when it must re-read something it only loads at startup, such as
a secret or credential that has just been rotated.

You do not need a separate restart after you change a Component's
configuration or deploy a new version in SVIEW. Those changes already replace
the pods with new ones.

Where to restart

SVIEW does not have a restart button. You restart a workload with kubectl,
through temporary namespace access:

  1. In SVIEW, go to Applications → Deployments and open the Component.
  2. Open the Access requests tab and click New.
  3. Under ACCESS ROLE, pick a role that allows changes to workloads, if the
    list offers one — the read-only role cannot restart anything (see the note
    below). Which roles are offered can differ between Environments. Pick an
    EXPIRATION TIME (TTL), add a JUSTIFICATION, and click Create.
  4. When the request is Approved, log in to Teleport and the cluster as
    described in Namespace Access.
ℹ️

The read-only namespace role lets you list pods and read logs, but a restart
is refused with a forbidden error. If the role list for your Component offers
no role with write access, raise a request in your dedicated Slack channel and
we restart it for you.

Restart the whole application

A rolling restart replaces every pod of the Deployment with a fresh one and
keeps the configuration exactly as it is:

kubectl get deployments -n <namespace>
kubectl rollout restart deployment/<deployment-name> -n <namespace>
kubectl rollout status deployment/<deployment-name> -n <namespace>

Pods are replaced a few at a time, and a new pod receives traffic only after
its readiness check passes. A Component that runs two or more replicas
normally stays available throughout. A Component with a single replica can
have a short interruption while its only pod is replaced.

For a Component that runs as a StatefulSet, use
kubectl rollout restart statefulset/<name> -n <namespace>. Its pods restart
one at a time, in order.

Restart one pod

To replace just one misbehaving pod, delete it. Kubernetes creates a
replacement straight away:

kubectl get pods -n <namespace>
kubectl delete pod <pod-name> -n <namespace>

Deleting the only pod of a single-replica Component takes it offline until the
replacement is ready. Use the rolling restart above in that case.

Verify it worked

kubectl get pods -n <namespace>

The pods show a recent AGE and the Running status with all containers
ready. Check the Component's Logs tab in SVIEW to confirm the application
started cleanly.

If the new pods fail as well, a restart will not fix it: see
Pod Keeps Restarting (CrashLoopBackOff).

Related articles


Did this page help you?