Chapter 3. Deploying a Kubernetes Cluster Flashcards
how do you create a local cluster ?
minikube start
how do you stop the local cluster ?
minikube stop
how do you remove the cluster ?
minikube delete
how do we we check cluster status ?
kubeclt version
how do we get a simple diagnostic for the cluster ?
kubectl get componentstatuses
how do you list all the nodes in your cluster ?
kubectl get nodes
how do you get more information about a node ?
kubectl describe nodes node-1
What does Kubernetes proxy do ?
The Kubernetes proxy is responsible for routing network traffic to load-balanced services in the Kubernetes cluster. To do its job, the proxy must be present on every node in the cluster.
how can you list the proxies ?
kubectl get daemonSets –namespace=kube-system kube-proxy
what is a Kubernetes DNS ?
A Kubernetes DNS provides naming and discovery for the services that are defined in the cluster. This DNS server also runs as a replicated service on the cluster
How can you get information about the Kubernetes DNS Server ?
kubectl get deployments –namespace=kube-system core-dns
how can you start Kubernetes GUI ?
kubectl get deployments –namespace=kube-system kubernetes-dashboard
or
kubectl proxy
How can you change the default namespace more permanently ?
- First create a context
kubectl config set-context my-context –namespace=mystuff - Sedond, use the context
kubectl config use-context my-context
What is the most basic command to for viewing Kubernetes objects ?
kubectl get
How can you get more detailed information about an objetct
- Adding: -o
- Adding: -o json
- Adding: -o yaml
- kubectl describe
How can you create objects in Kubernetes stored in yml file ?
kubectl apply -f obj.yaml
How can you edit objects in Kubernetes stored in yml file ?
kubectl apply -f obj.yaml
how can you use the apply command without making any changes ?
–dry-run
How can you make interactive edits ?
kubectl edit
How can you view the history of changes applied ?
kubectl apply -f myobj.yaml [ edit-last-applied | set-last-applied | view-last-applied }
how can you delete an object using yaml files ?
kubectl delete -f obj.yaml
how can you delete an object ?
kubectl delete
What command do you use to create labels ?
kubectl label pods bar color=red
What command do you use to create annotations ?
kubectl annotations pods bar color=red
How can you delete a label ?
kubectl label pods bar color-
How can you edit a label ?
Adding: -overwrite flag
How can you debug a container ?
kubectl logs
What flag do you need if you want continuously streams the logs ?
Adding: -f
How can you execute a command in a running container ?
kubectl exec -it – bash
What command do you need if you don’t have a bash or some other terminal ?
kubectl attach -it
how can you copy files to and from a container ?
kubectl cp :
how can you access your pod via the network ?
kubectl port-forward 8080:80
how can you check how your cluster is using resources ?
kubectl top nodes
similar this command
kubectl top pods