+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
https://kubernetes.io/docs/reference/kubectl/cheatsheet/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
kubectl
kubectl get - List resources
kubectl describe - Show details of a resource
kubectl create - Create a resource from a file or standard input
kubectl apply - Apply changes to a resource from a file or standard input
kubectl delete - Delete a resource by name or from a file or standard input
kubectl edit - Edit a resource
-- kubectl edit rs new-replicaset // new-replicaset
kubectl exec - Run a command in a container
kubectl logs - Print the logs for a container
kubectl port-forward - Forward one or more local ports to a pod
kubectl scale - Scale a deployment or replicaset
kubectl scale --replicas=6 -f replication-definition.yml
edit the "replication-definition.yml" file and use the replace command
kubectl replace -f replication-definition.yml
kubectl rollout - Manage rollouts of a deployment
kubectl config - Manage kubeconfig files
kubectl cluster-info - Display cluster information
kubectl version - Display the version of kubectl and the Kubernetes server

Services

SWITCH NAMESPACE:
to display all pods from all namespaces
kubectl get pods --all-namespaces
Namespaces :
BINDING
DELETE THE OLD POD AND RECREATE IT
If you do not want to continue monitoring the PODS by retyping agains and agains.
$ kubectl get pods --watch
you cannot move the running pod from one node to another . you can only delete and recreate the Pod on another,
TAINT AND TOLERATIONS
What will happen to Pods if they do not tolerate the taint. There are three taint effects.
No Schedule : Which means Pods will not be scheduled on the node.
PreferNoSchedule : Which means the system will try not to place the Pod on the node but is not guaranteed
NoExecute : which means new pods will not be scheduled on the node and the existing pods which do not have the toleration for the taints will be evicted. The Pods may have been scheduled before the taint has been applied.
The toleration does not guarantee that a Pod will be scheduled only on the Tainted node that with that toleration. The Pod with with Toleration can also be schedules on Nodes that has no taint.
In order for a Pod to be scheduled only to a specific node with a specific taint you need to implement - Node- Affinity.
No Pods gets scheduled on the Master Node.
When the Kubernetes cluster gets setup a taint is set on the Master Node automatically that prevents any Pods being scheduled automatically.
CHECK THE TAINT IN MASTER NODE
kubectl describe node kubemaster | grep taint
REMOVE THE TAINT ON CONTROL PLANE NODE
LABEL NODES
now when the podis created it is place in Node-01 as desired.
kubectl create -f pod-definition.yml
LIMITATION OF NODE SELECTORS
You cannot assign a pod to a node if you were to have two conditions such as
-- Assign Pod to Large of Medium nodes
-- Or Assign pod other than smaller nodes.
NODE AFFINITY
you do not need a value section for this one , it just checks for the key=size
Second Part of the node affinity rule "IgnoredDuringExecution" -- If there were Any change in the environment such as the labels of the node were removed . The node affinity rule will not affect the the running Pods on the node.
The Pods will continue to run and any changes in the node Affinity rile will not affect them once it is scheduled.
In the future we may have the below affinity rule which will evict the node that do not meet the affinity rules.
RESOURCES:
RESOURCE QUOTA- NAMESPACE LEVEL
Lets say all the Pods together shouldn't exceed consume more than a certain number of CPU .
Comments
Post a Comment