Kubernetess - erikpa1/MyExperience GitHub Wiki
Source tutorial
https://www.youtube.com/watch?v=X48VuDVv0do&list=PPSV
Terminology
Pod - the smallest unit of kubernetess cluster.
Replicaset - is managing replicas of the pod. In practice you don't have to create them, update, delete or manage in any way.
Installation on mac
brew install minikube
brew install docker
Starting
minikube start --vm-driver=docker
Debugging
Getting status of running nodes
kubectl get nodes
minikube status
kubectl get services
kubectl get pod
kubectl get pod -o wide //more concrete pod info
kubectl get replicaset
kubectl get deployment [deployment] -o yaml
kubectl get deployment [deployment] -o yaml > [savefilename.yaml]
kubectl logs [podname]
kubectl describe pod [podname]
kubectl descripe service [service name]
kubectl get all
Creating kubernetess components
kubectl create -h. // -h help,
Demo deployment - Ngingx
Create deployment has all the information or blueprints to create the pod. The most basic (minimalistic) configuration for deployment - name and image to use
kubectl create deployment nginx-depl --image=nginx
kubeclt get deployment //to see list of deploymnets
kubectl logs nginx-depl-[podname]
Edit deployment
kubectl edit deployment nginx-depl
Demo deployment - Mongo
kubectl create deployment mongo-depl --image=mongo
kubectl logs mongo-depl-[podname]
Exec
-it - means interactive terminal
kubectl exec -it [podname] -- bin/bash
exit //for leaving container
Deleting
kubectl get deployment
kubectl delete deployment [deployment]
kubectl get pod // you should see Pod in status [Terminating]
Apply config file
kubectl apply -f nginx-deployment.yaml
Demo kubernetess file:
http://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment
Kubernetess file has following structure:
- metadata
- specification
- status - automatically generated and added by Kubernetess
Types of file:
- component
- service - opens component to the outer world
Namespaces
kubectrl api-resources --namespaced=false //shows resources without namespace
kubectrl api-resources --namespaced=true
Utilities and plugins
kubectx
brew install kubectx
kubens // list kubernetess namespaces
Ingress
Component which should be used in produciton. Instead of direct expose to the service.
--watch - to not refresh table, this one waits, and refresh console for you...
kubectl get ingress -n kubernetes-dashboard --watch
Helm
Package manager for kuberneters.
Tiller
Keeps histroy of helm charts executions. Removed in Helm 3.