All Pods Have the app and version Labels
Description
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.
Rectification Guide
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.
- Copy the original workload configuration and save it as a YAML file.
kubectl get deployment {deploymentName} -n {namespace} -o yaml > {deploymentName}-deployment.yaml
For example:
kubectl get deployment productpage -n default -o yaml > productpage-deployment.yaml
- Modify the productpage-deployment.yaml file. If the file does not contain app and version, add them. You are advised to set app to the Service name and the version to v1.
- Delete the original workload.
kubectl delete deployment {oldDeploymentName} -n {namespace}
- Apply the new workload configuration.
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:
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot