All pods of a Service must be labeled with app and version. app traces traffic in traffic monitoring, and version distinguishes different versions in grayscale release. If a pod is not labeled with app or version, this item is abnormal.
The labels of pods are configured in spec.template.metadata.labels of the Deployment. The recommended configuration is as follows:
labels: app: {serviceName} version: v1
Modifying or deleting the Deployment will trigger pod rolling upgrade, which may cause temporary service interruption. Therefore, perform the operation at a proper time.
kubectl get deployment {deploymentName} -n {namespace} -o yaml > {deploymentName}-deployment.yaml
For example:
kubectl get deployment productpage -n default -o yaml > productpage-deployment.yaml
kubectl delete deployment {oldDeploymentName} -n {namespace}
kubectl apply -f productpage-deployment.yaml
For clusters of v1.15 or earlier, you can modify pod labels on the CCE console, but residual ReplicaSets may exist.
To check whether there are residual ReplicaSets, perform the following steps: