Kubernetes Topics (3)Tap to view
    Kubernetes·Container Orchestration·Topic 2 of 3

    Kubernetes Deployments & Rollouts

    Managing and publishing distributions (Deployments), scaling, tracking and rolling back successive updates (Rollouts).

    1. Deployment Management & Rollout Control

    1. kubectl create deployment <name> --image=<image>

      What it doesCreates a new Deployment in the current namespace of the specified image

      When to use itTo quickly launch a new service for testing without writing a full YAML file

      Examplekubectl create deployment nginx-web --image=nginx:alpine

    2. kubectl get deployments -n <ns>

      What it doesDisplays the status of distributions with the number of ready, requested and updated copies

      When to use itto check the stability of services and the number of mirrors available

      Examplekubectl get deployments -n production

    3. kubectl scale deployment/<name> --replicas=<num> -n <ns>

      What it doesChange the number of copies of Pods required for the distribution manually and directly

      When to use itto handle sudden load spikes or reduce resource consumption in development environments

      Examplekubectl scale deployment/api-server --replicas=5 -n production

    4. kubectl set image deployment/<name> <container>=<new-image> -n <ns>

      What it doesUpdates the container image in the distribution, starting a Rolling Update

      When to use itWhen a new software version of the application is released and implemented

      Examplekubectl set image deployment/frontend web=frontend:v2.1.0 -n production

    5. kubectl rollout status deployment/<name> -n <ns>

      What it doesMonitors the progress of the gradual deployment process in real time until all Pods are completed successfully

      When to use itIn CI/CD scripts to ensure successful deployment

      Examplekubectl rollout status deployment/api-server -n production

    6. kubectl rollout history deployment/<name> -n <ns>

      What it doesDisplays the history of revisions, previous versions of the distribution, and revision numbers

      When to use itTo find out previous modifications and specify the version number you wish to refer to

      Examplekubectl rollout history deployment/api-server -n production

    7. kubectl rollout undo deployment/<name> -n <ns>

      What it doesImmediately roll back the latest update and return the distro to the previous stable version

      When to use itWhen a critical bug is detected immediately after deployment to the production environment

      Examplekubectl rollout undo deployment/api-server -n production

    8. kubectl rollout restart deployment/<name> -n <ns>

      What it doesRestarts all distribution pods alternately and without any interruption in service

      When to use itTo apply ConfigMap or Secret changes without modifying the application code itself

      Examplekubectl rollout restart deployment/worker-queue -n production

    Offline · Reading cached copy