[Kubernetes] Scaling ReplicaSets

Kubernetes Scaling ReplicaSets

  • Start a new deployment for one replica/pod
    • kubectl run my-apache --image httpd
  • Let's scale it up with another pod
    • kubectl scale deploy/my-apache --replica 2
    • kubectl scale deployment my-apache --replica 2
    • those are the same command
    • deploy = deployment = deployments
  • Inspecting Deployment Objects
    • kubectl get pods
    • Get container log
    • kubectl logs deployment/my-apache --follow --tail 1
    • Get a bunch of details about an object, including events!
    • kubectl logs -l run=my-apache 這些指令是quick truble shooting,但並不能取代完整的log系統
    • kubectl describe pod/my-apache-5d589d69c7-r6w54 取得某一個Pod的詳細資訊
    • Watch a command (without needing watch)
    • kubectl get pods -w
    • In a separate tab/window
    • kubectl delete pod/my-apache-xxxx-yyyy
    • Watch the pod get re-created