Kubernetes Scratchpad
Jump to navigation
Jump to search
#!/usr/bin/env bash # set -e shopt -s expand_aliases alias kubectl='microk8s kubectl' delete(){ kubectl delete deployment hello1 kubectl delete deployment hello2 kubectl delete service hello1 kubectl delete service hello2 kubectl delete -f hello1-ingress.yml kubectl delete -f hello2-ingress.yml } add(){ microk8s status microk8s enable ingress kubectl get pods -n kube-system kubectl create deployment hello1 --image=gcr.io/google-samples/hello-app:1.0 kubectl create deployment hello2 --image=gcr.io/google-samples/hello-app:2.0 kubectl expose deployment hello1 --type=NodePort --port=8080 kubectl expose deployment hello2 --type=NodePort --port=8080 kubectl apply -f hello1-ingress.yml kubectl apply -f hello2-ingress.yml kubectl get service hello1 kubectl get service hello2 kubectl get service -o wided kubectl get ingress } web(){ # https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/ kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0 kubectl expose deployment web --type=NodePort --port=8080 kubectl create deployment web2 --image=gcr.io/google-samples/hello-app:2.0 kubectl expose deployment web2 --port=8080 --type=NodePort # kubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml kubectl apply -f example-ingress.yml curl -H "Host: hello-world.info" 127.0.0.1 } get(){ kubectl get ingress kubectl get service kubectl get pods kubectl get nodes kubectl describe svc kubectl describe svc hello1 curl -H "Host: hello1.uvoo.io" 127.0.0.1 } # get add