Christoph Raab

All about DevOps...

CheatSheet
cheatsheet/kubernetes/certification-hints

Certification Hints

Linux Foundation PDF Guide

Imperative vs Declarative

Imperative

Declarative

kubect.kubernetes.io/last-applied-configuration: {"apiVersion": "v1", "kind": ... }

Create yml

Pod

kubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yml

Get yml of running pod:

kubectl get pod <name> -o yaml --export > pod.yml

Deployment

kubectl create deployment --image=nginx nginx --dry-run=client -o yaml > deploy.yml

Service

Type: ClusterIP

kubectl expose pod redis --port=6379 --name redis-service --dry-run=client -o yaml > svc.yml

or

kubectl create service clusterip redis --tcp=6379:6379 --dry-run=client -o yaml > svc.yml

Type: NodePort

kubectl expose pod nginx --port=80 --name nginx-service --type=NodePort --dry-run=client -o yaml > svc.yml

or

kubectl create service nodeport nginx --tcp=80:80 --node-port=30080 --dry-run=client -o yaml > svc.yml

YAML

Frucht: Apfel Fleisch: Huhn [...]

`` Früchte:

Banane: Kalorien: 75 Fett: 1 [...]

Json Path with kubectl