A Pod is a group of one or more application containers (such as Docker or rkt) and includes shared storage (volumes), IP address and information about how to run them.
$ kubectl get pods -l run=kubernetes-bootcamp NAME READY STATUS RESTARTS AGE kubernetes-bootcamp-5c69669756-hmc69 1/1 Running 0 8m $ kubectl get services -l = run=kubernetes-bootcamp error: name cannot be provided when a selector is specified $ kubectl get services -l run=kubernetes-bootcamp NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes-bootcamp NodePort 10.99.175.225 <none> 8080:32172/TCP 6m
新增标签
1 2 3 4 5 6 7 8 9 10 11 12 13
$ kubectl label pod $POD_NAME app=v1 pod "kubernetes-bootcamp-5c69669756-hmc69" labeled $ kubectl describe pods $POD_NAME Name: kubernetes-bootcamp-5c69669756-hmc69 Namespace: default Node: minikube/172.17.0.11 Start Time: Tue, 17 Jul 2018 05:20:35 +0000 Labels: app=v1 pod-template-hash=1725225312 run=kubernetes-bootcamp $ kubectl get pods -l app=v1 NAME READY STATUS RESTARTS AGE kubernetes-bootcamp-5c69669756-hmc69 1/1 Running 0 11m
删除服务
1 2 3 4 5 6 7 8 9
$ kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 12m kubernetes-bootcamp NodePort 10.99.175.225 <none> 8080:32172/TCP 10m $ kubectl delete service -l run=kubernetes-bootcamp service "kubernetes-bootcamp" deleted $ kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 12m