liveBook · Manning

Kubectl rollout restart

As explained in Road to Kubernetes

kubectl rollout restart is a kubectl command that triggers a new rollout of a Kubernetes workload without deleting the workload resource.

kubectl rollout restart triggers a new rollout for a Kubernetes Deployment without deleting and recreating the workload resource. It is useful when an image such as :latest changes but the manifest itself does not. section 8.5.2

Restart the application Deployments

After applying manifests, run kubectl rollout restart deployment py-deploy and kubectl rollout restart deployment js-deploy. Kubernetes then starts new rollouts even when applying the same unchanged manifest would not detect an update. section 8.5.2

Listing 8.28 GitHub Actions workflow for deploying our apps
name: Update K8s App Deployments
on:
  workflow_dispatch:

jobs:
  verify_service_account:
    name: Verify K8s Service Account
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo Code
        uses: actions/checkout@v4
      - uses: azure/setup-kubectl@v3
      - name: Create/Verify `.kube` directory
        run: mkdir -p ~/.kube/
      - name: Create kubectl config
        run: |
          cat << EOF >> ~/.kube/config
          ${{ secrets.KUBECONFIG_SA }}
          EOF
      - name: Echo pods
        run: |
          kubectl get pods
      - name: Echo deployments
        run: |
          kubectl get deployments
      - name: Apply App Changes
        run: |
          kubectl apply -f apps/
      - name: Rollout Apps
        run: |
          kubectl rollout restart deployment -n default py-deploy
          kubectl rollout restart deployment -n default js-deploy

A GitHub Actions workflow places kubeconfig, checks Pods and Deployments, applies manifests, and restarts both application Deployments. section 8.5.2

How Road to Kubernetes covers it

How deep it goes
Explains the command’s purpose and placement in a workflow, but does not detail rollout internals or status monitoring.
Examples
Uses py-deploy and js-deploy commands within a workflow that applies manifests and inspects Pods and Deployments.
What it assumes
Assumes familiarity with Kubernetes manifests, Deployments, kubectl, and kubeconfig while demonstrating their workflow roles.
What you can do after
Operate/configure Kubernetes Deployments by restarting rollouts when unchanged manifests do not reveal updated :latest images.
How it connects
Connects Kubernetes Deployments with kubectl apply, GitHub Actions, kubeconfig, and container image tags.

Also explained in

Compare how 2 books explain kubectl rollout restart →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.