Exercise 12.1: Assign Pods Using Labels
kubectl get nodekubectl get node --show-labelskubectl get nodes \ -o=custom-columns=NodeName:.metadata.name,TaintKey:.spec.taints[*].key,TaintValue:.spec.taints[*].value,TaintEffect:.spec.taints[*].effectkubectl get pod --all-namespaces -o widekubectl describe node | grep -E "(^Name:|^Non-terminated)"{ kubectl label nodes cp status=vip kubectl label nodes worker status=other }kubectl get nodes --show-labels | grep --color 'status\|$'cat <<EOF | kubectl create -f - apiVersion: v1 kind: Pod metadata: name: vip spec: terminationGracePeriodSeconds: 0 containers: - name: busybox image: busybox args: - sleep - "1000000" nodeSelector: status: vip EOFkubectl get pod vip -o widekubectl delete pod vipcat <<EOF | kubectl create -f - apiVersion: v1 kind: Pod metadata: name: vip spec: terminationGracePeriodSeconds: 0 containers: - name: busybox image: busybox args: - sleep - "1000000" EOFkubectl get pod vip -o widecat <<EOF | kubectl create -f - apiVersion: v1 kind: Pod metadata: name: other spec: terminationGracePeriodSeconds: 0 containers: - name: busybox image: busybox args: - sleep - "1000000" nodeSelector: status: other EOFkubectl get pod other -o widekubectl delete pod vip other
Last updated