Skip to content

Latest commit

 

History

History
35 lines (32 loc) · 1.79 KB

kubernets.md

File metadata and controls

35 lines (32 loc) · 1.79 KB

Core components:

Pod, service, ingress, deployment, statefulset, volumes, configmap, secrets

Installation (Linux)

  • Minikube - Suitable for local setup that has one node containing master and workers in the same node, you can run this on top of docker runtime or using virtualbox(installation seperate).
    • Starting minikube: minikube start --vm-driver=virtualbox
    • Start with docker runtime: minikube start --vm-driver=none
  • Kubectl - command to control the whole k8s cluster. Acts like the main control panel for k8s

Essential Kubectl commands:

  • Setup a new deployment: kubectl apply -f ./app.yaml
    • This sets up everything right from pot to container and also launch the cluster with settings mentioned in app.yaml
  • Create deployment from public docker image (eg, ngnix)
    • kubectl create deployment mongdb-server --image=mongo (check the registry image name)
  • See all pods: kubectl get pods
  • Pod details (verbose): kubectl get pod -o wide
  • Checking logs: kubectl logs <pod-id>
  • Delete pod: kubectl delete pods <pod-id> --force
  • Pod details: kubectl describe pod <pod-id>
  • Service details: kubectl describe service <service-id>
  • Delete all pods (caution with force flag): kubectl delete all --all --all-namespaces --force
  • Check services: kubectl get services
  • Check deployment: kubectl get deployment
  • Check all nodes: kubectl get nodes
  • Editing kubectl deployment: kubectl edit deployment <deployment-name>
    • upon editing, old pod gets deleted, new pod gets created. And a new replicaset also gets created
  • Just like in docker, it is possible to login to the shell of the pod
    • kubectl exec -it <pod-id> -- bin/bash

config.yaml file

Two types: deployment.yaml; service.yaml

  • Info about components
  • spec (also contains pod config)
  • status (Autogenerated)