k8s重启服务(kubectl)

时间:2025-03-26 20:55:09

步骤

Service

kubectl get services -n feature-1 | grep xxx
xxx-cloud-xxx-xxx-service                     ClusterIP   172.21.7.9      <none>        8080/TCP,9999/TCP   5d23h

Deployment

kubectl get deployments xxx-cloud-xxx-xxx-service -n feature-1
NAME                              READY   UP-TO-DATE   AVAILABLE   AGE
xxx-cloud-xxx-xxx-service   1/1     1            1           5d23h

重启Deployment

kubectl rollout restart deployment xxx-cloud-xxx-xxx-service -n feature-1

查看Deployment重启状态

kubectl rollout status deployment xxx-cloud-xxx-xxx-service -n feature-1

参考:

  • How to Restart Kubernetes Pods With Kubectl
  • Deployments