Difference between revisions of "K8"

From no name for this wiki
Jump to: navigation, search
 
Line 46: Line 46:
 
         - name: web
 
         - name: web
 
           image: nginx
 
           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

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/

microk8

minikube