Kubernetes Cheat Sheet:

- From the hr pod nslookup the mysql service and redirect the output to a file /root/CKA/nslookup.out
$ kubectl exec -it hr - - nslookup mysql.payroll > /root/CKA/nslookup.out
# Create Pod with labels
$ kubectl run pod messaging --image=redis:alpine --labels=tier=msg --dry-run=client -o yaml
#JSON PATH query to retrieve the osImages of all the nodes.
$ kubectl get nodes -o jsonpath='{.items[*].status.nodeInfo.osImage}'
# Create a service messaging-service to expose the messaging application within the cluster on port 6379.
$kubectl expose pod messaging --name messaging-service --port 6379 --target-port 6379
# create deployment with Nginx Image version 1.16
$ kubectl create deploy nginx-deploy --image=nginx:1.16 --replicas=1
# Update the deployment version to new version of nginx 1.17.
$ kubectl set image deployment/nginx-deploy nginx=nginx:1.17 --record
#Create Role Name: developer, namespace: development, Resource: Pods
$ kubectl create role developer --namespace=development --resource=pods --verb=create,list,get,update,delete
# Create Role binding.
$ kubectl create rolebinding developer-role-binding --role=developer --user=john --namespace=development

#Check kubelet service and identify the network plugin configured for Kubernetes.

The network plugin configured is — network-plugin=cni


# Path configured with all binaries of CNI supported plugins.

The CNI binaries are located under /opt/cni/bin by default.

cni — supported Binaries.

#Where to check what is the CNI plugin configured to be used on this kubernetes cluster?

it’s in the directory — /etc/cni/net.d

cni-plugin config path

#What is POD IP range configured by weave.

#What type of proxy is the kube-proxy configured to use?

  • Check the logs of the kube-proxy pods. Run the command:

$ kubectl logs <kube-proxy-pod-name> -n kube-system


# Where is the configuration file located for configuring the CoreDNS service?

config file- Core DNS

# How is the Corefile passed in to the CoreDNS POD?

Run the command:

$ kubectl get configmap -n kube-system

Look at the coredns ConfigMap. It's passed through the ConfigMap volume in the deployment.

#What is the root domain/zone configured for this kubernetes cluster?

Run the command:

$kubectl describe configmap coredns -n kube-system

Look for the entry after kubernetes.

Kubernetes Root domain

# From the hr pod nslookup the mysql service and redirect the output to a file /CKA/nslookup.out

$kubectl exec -it hr — nslookup mysql > /root/CKA/nslookup.out

Stay hungry; Stay Foolish!!