You are on page 1of 1

KUBERNETES Master Kubectl Command List

• Pods and Container Introspection • Objects


• It is responsible for maintaining the desired state for the cluster you

CHEAT SHEET
are working on. COMMANDS FUNCTION All clusterrolebindings clusterroles
• “Master” indicates a set of processes that are used to manage the
Kubectl get pods Lists all current pods crd=custom
cluster.
cm= conf gmaps controllerrevisions resource
• Contains info, API, scheduler, replication controllers, and master.
Kubectl describe pod<name> Describes the pod names definition
KUBERNETES
Kubectl get rc List all replication controllers csr= certificate
Cronjobs cs=component status
• It is an open source platform for automating deployment and signing requests
scaling of containers across clusters of hosts providing Kubectl get rc -- Lists replication controllers in
container centric infrastructure. Deploy=deployments ds= daemon sets ep=end points
namespace=”namespace” namespace
• It is a container orchestrator and can run Linux containers:
• Launch container. ev= events hpa= autoscaling ing= ingress
• Maintain and monitor container site. Shows the replication
Kubectl describe rc <name> Netpol- network
• Performs container-oriented networking controller name jobs limits=limit ranges
policies
Kubectl get cvc Lists the services
No = nodes ns= namespaces pdb= pod
Worker Nodes/Minions Kubectl describe svc<name> Shows the service name po= pods Pod preset Pod templates
• Also called as a minion. It contains the services necessary to run the
Kubectl delete pod<name> Deletes the pod Psp= pod security Pv= persistent pvc= persistent
pods that are managed by the master.
policies volumes volume claims
• Some services include: container runtime, Kubelet, kube-proxy. Kubectl get nodes -w Watch nodes continuously
• Contains: Kubelet, cAdvisor, services, pods and containers. quota= resource rc= replication
• Debugging Role bindings
quotas controllers

FUNCTION COMMAND sa=service


roles rs= replica sets
account
Kubectl
Execute command on service by
exec<service><commands>[- sc= storage classes secrets sts= stateful sets
Key Concepts selecting container.
c< $container>] • Cluster Introspection
Now let’s discuss the key points of this architecture. Kubectl logs -f<name>>[-c< FUNCTION COMMAND
Get logs from service for a container
$container>]
• Pod: These are the group of containers.
Get version information Kubectl version
• Labels: These are used to identify the pods.
• Kubelet: They are container agents, responsible for maintaining Watch -n 2
Watch the kubelet logs Get cluster information Kubectl cluster-info
the set of pods. cat/var/log/kublet.log
• Proxy: They are the Load balancer for pods, helping in
distributing tasks across the pods. Show metrics for node Kubectl top node Get the configuration Kubectl config g view
• ETCD: A Metadata service.
• Cadvisor: For resource usage and performance stats. Show metrics for pods Kubectl top pod Output info about a node Kubectl describe node<node>
• Replication controller: It manages pod replication. Features
• Scheduler: Used for pod scheduling in worker nodes.
• API server: Kubernetes API server. • Automated scheduling- provides an advanced scheduler that helps
launch container on cluster nodes Other Quick Commands
Now let’s understand the role Master and Node play in the • Self healing- reschedule, replace and restart dead containers.
Kubernetes Architecture. • Automated rollouts and rollbacks- supports rollback for systems Launch a pod with a name an image : Kubectl run<name> -- Map external port to internal replication port : Expose rc<name> -
incase of a failure. Enables rollout and rollback for the desired state. image=<image-name> -port=<external>--target-port=<internal>
• Horizontal scaling- can scale up and down the app as per required. Can Create a service in <manifest.yaml> : Kubectl create -f To stop all pod in <n> : Kubectl drain<n>-- delete-local-data--force--
also be automated wrt CPU usage. <manifest.yaml> ignore-daemonset
• Service discovery and load balancing- uses unique ip and dns name to Scale replication counter to count the number of instances Allow master nodes to run pods : Kubectltaintnodes --all-node-
containers. This helps identify them across different containers. : Kubectl scale --replicas=<count> role.kuernetes.io/master-
FURTHERMORE: Kubernetes Training

You might also like