Giter Club home page Giter Club logo

cheatsheet-kubernetes-a4's Introduction

cheatsheet-kubernetes-A4

Kubernetes CheatSheets In A4

PRs Welcome

LinkedIn slack Github

Printable version on A4 page: cheatsheet-kubernetes-A4.pdf. See more CheatSheets here

Table of Contents

Key Concepts

Name Summary
CRI Container Runtime Interface
CNI Container Network Interface
CSI Container Storage Interface
CNCF Cloud Native Computing Foundation

Minikube

minikube in GitHub: link

Name Summary
minikube start Start minikube env
minikube dashboard Get dashboard
minikube ssh ssh to minikube vm
minikube ip Get ip
kubectl cluster-info Get cluster info
minikube addons list List addons
minikube service $srv_name Get service info

Kubernets Critical Files

Name Summary
/etc/kubernetes/ config folder
/etc/kubernetes/pki/ certificate files
/etc/kubernetes/kubelet.conf credentials to API server
/etc/kubernetes/admin.conf superuser credentials
/var/lib/kubelet/ kubernets working dir
/var/lib/docker docker working dir
/var/lib/etcd
/etc/cni/net.d network cni
/var/log/containers
/var/log/pods log files
export KUBECONFIG=/etc/kubernetes/admin.conf env
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf env
kubectl get --namespace kube-system pods -a list all critical pods
kubelet logs logs

Check status

Name Command
Get kubectl version kubectl version
Get cluster info kubectl cluster-info
Get configuration kubectl config view
kubectl get service --all-namespaces
kubectl describe node $node_name
kubectl get svc
kubectl -n kube-system get cm kubeadm-config -oyaml system conf
curl -L http://127.0.0.1:10250/healthz

Common Commands

Name Command
List all services kubectl get services
List all pods kubectl get pods
List all pods kubectl get pods –all-namespaces
List all pods with details kubectl get pods -o wide
Get pod info kubectl describe pod srv-mysql-server
Open a bash terminal in a pod kubectl exec -ti storage -- bash
Check pod environment variables kubectl exec redis-master-ft9ex env
Delete pod kubectl delete pod hello-node-95913-n63qs
Start a service kubectl run hello --image=my_img --port=80
Similar to docker ps kubectl get nodes
Similar to docker inspect kubectl describe pod nginx-app-413181-cn
Similar to docker logs kubectl logs
Similar to docker exec kubectl exec
View cluster events kubectl get events
Get deployment info kubectl get deploy
Get replication controller kubectl get rc
Delete service kubectl delete service nginxservice
Delete replication controller kubectl delete rc nginx

Pod

Name Command
Add label to pod kubectl label pods labelex owner=denny
List all pods with labels kubectl get pods --show-labels
Filter pod by label `kubectl get pods --selector owner=michael

Volume

Name Command
Check the mounted volumes kubectl exec storage ls /data
Check persist volume kubectl describe pv pv0001

Scale & Deployment

Summary Command
Scale out kubectl scale --replicas=3 deployment/nginx-app
online rolling upgrade kubectl rolling-update app-v1 app-v2 --image=img:v2
Roll backup kubectl rolling-update app-v1 app-v2 --rollback
Check update status kubectl rollout status deployment/nginx-app
Check update history kubectl rollout history deployment/nginx-app

TODO: rolling-update command is imperative, better use Deployments rollout. It's declarative.

$ kubectl --help
kubectl controls the Kubernetes cluster manager.

Find more information at https://github.com/GoogleCloudPlatform/kubernetes.

Usage:
  kubectl [flags]
  kubectl [command]

Available Commands:
  get            Display one or many resources
  describe       Show details of a specific resource
  create         Create a resource by filename or stdin
  update         Update a resource by filename or stdin.
  delete         Delete a resource by filename, stdin, resource and ID, or by resources and label selector.
  namespace      SUPERCEDED: Set and view the current Kubernetes namespace
  logs           Print the logs for a container in a pod.
  rolling-update Perform a rolling update of the given ReplicationController.
  scale          Set a new size for a Replication Controller.
  exec           Execute a command in a container.
  port-forward   Forward one or more local ports to a pod.
  proxy          Run a proxy to the Kubernetes API server
  run            Run a particular image on the cluster.
  stop           Gracefully shut down a resource by id or filename.
  expose         Take a replicated application and expose it as Kubernetes Service
  label          Update the labels on a resource
  config         config modifies kubeconfig files
  cluster-info   Display cluster info
  api-versions   Print available API versions.
  version        Print the client and server version information.
  help           Help about any command

...
...
...

Related Resources

License

cheatsheet-kubernetes-a4's People

Watchers

James Cloos avatar Jibin Rajan Varghese avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.