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

