Difference between revisions of "K8"
(→Auf Container verbinden) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 20: | Line 20: | ||
<pre> | <pre> | ||
kubectl exec -it <pod-name> -- /bin/sh | kubectl exec -it <pod-name> -- /bin/sh | ||
+ | </pre> | ||
+ | |||
+ | === Reverse Proxy zu einem pod erstellen === | ||
+ | <pre> | ||
+ | kubectl port-forward <podname> 8000:80 | ||
+ | </pre> | ||
+ | |||
+ | == YAML Samples == | ||
+ | === Einfaches Deployment === | ||
+ | <pre> | ||
+ | apiVersion: apps/v1 | ||
+ | kind: Deployment | ||
+ | metadata: | ||
+ | name: web | ||
+ | spec: | ||
+ | selector: | ||
+ | matchLabels: | ||
+ | app: web | ||
+ | template: | ||
+ | metadata: | ||
+ | labels: | ||
+ | app: web | ||
+ | spec: | ||
+ | containers: | ||
+ | - name: web | ||
+ | image: nginx | ||
+ | </pre> | ||
+ | |||
+ | == kustomize == | ||
+ | === YAML Files generieren (in stdout) === | ||
+ | <pre> | ||
+ | kubectl kustomize ./kostomize | ||
+ | </pre> | ||
+ | === Apply kustomize === | ||
+ | kubectl apply -k ./kustomize/ | ||
</pre> | </pre> | ||
Latest revision as of 11:03, 26 June 2021
Kubernetes
Contents
kubectl
Nützliche kubectl Kommandos
Default namespace setzen
kubectl config set-context minikube --namespace=mynamespace
Netzwerk image aufstarten mit bash
kubectl run my-shell --rm -it --image amouat/network-utils -- bash
https://hub.docker.com/r/amouat/network-utils/
Auf Container verbinden
kubectl exec -it <pod-name> -- /bin/sh
Reverse Proxy zu einem pod erstellen
kubectl port-forward <podname> 8000:80
YAML Samples
Einfaches Deployment
apiVersion: apps/v1 kind: Deployment metadata: name: web spec: selector: matchLabels: app: web template: metadata: labels: app: web spec: containers: - name: web image: nginx
kustomize
YAML Files generieren (in stdout)
kubectl kustomize ./kostomize
Apply kustomize
kubectl apply -k ./kustomize/