Term
|
Definition
- kubectl top node (or pod) |
|
|
Term
|
Definition
- if single container kubectl logs -f "pod" - if multi containers kubectl logs -f "pod" "container" |
|
|
Term
|
Definition
- kubectl rollout status deploy "name" - kubectl rollout history deploy "name" |
|
|
Term
|
Definition
- recreate all (at same time) - rolling update (one at a time - default) |
|
|
Term
Set new deploy image (imperative) |
|
Definition
kubectl set image deploy "name" old_image=new_image |
|
|
Term
Undo rollout (or rollback) |
|
Definition
- kubectl rollout undo deploy "name" - uses saved replica set |
|
|
Term
|
Definition
- kubectl create configmap "map name" --from-literal=key=value - kubectl create configmap "map name" --from-file=filename |
|
|
Term
|
Definition
apiVersion: v1 kind: ConfigMap metadata: name: "map name" data: key1:value1 |
|
|
Term
|
Definition
kubectl get/describe configmap (or cm) |
|
|
Term
|
Definition
spec: envFrom: - configMapRef: name: OR containers: - name: image: command: env: - name: key1 valueFrom: configMapKeyRef: name: special-config key: key1 |
|
|
Term
|
Definition
- kubectl create secret generic \ "sec name" --from-literal=key1=value1 kubectl create secret generic \ "sec name" --from-file="filename" |
|
|
Term
|
Definition
apiVersion: v1 kind: Secret metadata: name: "name" data: key1: "base64-encoded-value" |
|
|
Term
|
Definition
- kubectl get secret "name" -o yaml - values in base64 |
|
|
Term
|
Definition
spec: containers: - name: envFrom: - secretRef: key1: value1 OR spec: envFrom - secretRef name: "sec-name" OR volumes: - name: secret: secretName: "sec-name" |
|
|
Term
|
Definition
kubectl exec -it "pod" cmd param |
|
|
Term
|
Definition
spec: containers: initContainers: - name: image: command: ['cmd', 'param1', 'param2'] - name: image: command:
- if multi initContainers, each one run one at a time sequentially with each one finishing before next starts - after all initContainers run, then run regular containers |
|
|
Term
|
Definition
- kubectl drain "node" - "node" marked as unscheduable - to reverse -kubectl uncordon "node" - kubectl cordon "node" - don't schedule any pods on nodes - pods recreated on other running nodes |
|
|
Term
|
Definition
- kubectl get nodes - v(maj).(min).(patch) - minor = features/functions - patch = patches/bug fixes |
|
|
Term
|
Definition
- kube-apiserver can be X - controller-manager & kube-schedeler can be X or X-1 - kubelet & kube-proxy can be X, X-1 or X-2 - kubectl can be X or X+1 > X-1 - only current minor plus last 2 minor vers supported |
|
|
Term
|
Definition
- upgrade only one minor version at a time - upgrade master first - cannot deploy, modify or access pods while upgrading master - Strategy 1 - upgrade all nodes at once - Strategy 2 - upgrade one node at a time - Strategy 3 - add new node with latest ver to replace each node |
|
|
Term
|
Definition
- kubeadm upgrade plan - get ver #'s and other data - Upgrade steps: 1) update kubeadm (apt-get) 2) kubeadm upgrade apply "v#" 3) upgrade kubelet (apt-get) 4) systemctl restart kubelet 5) kubectl uncordon master 6) for each node one at a time 1) Move workloads with kubectl drain "node" 2) upgrade kubeadm & kubelet 3) kubeadm upgrade node 4) system restart kubelet 5) kubectl uncordon "node" |
|
|
Term
to query/save all yaml configs |
|
Definition
- kubectl get all -all-namespaces -o yaml > all-deploy-srvs.yaml |
|
|
Term
to query/save/restore all etcd |
|
Definition
- etcdctl snapshot save snapshot.db - etcdctl snapshot status snapshot.db - etcdctl snapshot restore snapshot.db |
|
|
Term
|
Definition
- create snapshot - service kube-apiserver stop - restore snapshot using new token and data dir (if we want to dup a live cluster) - change token and data dir in etcd.yaml - systemctl daemon-reload - service etcd restart - service kube-apiserver start |
|
|
Term
|
Definition
- Resource configurations (yaml) - ETCD DB |
|
|