kubectl get pods --show-labels
demo:
kubectl get pods --show-labels -n his
[root@master231 pod]# cat 10-pods-labesl.yaml
apiVersion: v1
kind: Pod
metadata:
name: baimei-linux86-labels
# 给Pod资源添加标签
labels:
# school: baimei
school: dashu
# class: linux86
spec:
containers:
- name: web
image: harbor.baimei.com/baimei-web/nginx:1.25.1-alpine
部署
kubectl apply -f 10-pods-labesl.yaml
kubectl get pods --show-labels
欢迎来撩 : 汇总all