Debug School

Rakesh Konda
Rakesh Konda

Posted on

Namespaces, Troubleshoot of POD, Replication controller, Replication set, Deploy

NameSpace

  1. Kubernetes namespaces create a logical sub clusters in side the cluster so that we can restrict the resources usage to the specific limit for each group.
  2. Logical sub clusters are created in horizontal not the vertical
  3. By logical sub clusters, each sub cluster will have its own namespace
  4. For system deployment pods we have system name space, for default pods default namespace and for public pods public namespace

Command to create name space :
kubectl create ns
To see all the namespaces:
kubectl get -n

Troubleshoot of POD

Logs, attach, copy, port forwarding

Logs : with this we can see the logs of the pods
command : kubectl logs -n
Attach : With this we can see the live logs
command : kubectl attach -n
Copy : Used to copy files from node to Pod
Command : kubectl cp pod.yaml :/ -n
Port forwarding : With this we can expose the pod to outer world
Command : kubectl port-forward --address 0.0.0.0 pod/ :80
How to check : hodeip(not the pod ip): port to expose to outer world

Replication controller, Replication set

Both are same Replication set is next version of replication controller with some bug fixes
Using Replication set we can scale the pods to desired number at any moment of time
Command : kubectl create rs -f <.yamfile> -n
Command : kubectl get rs -n (to know the the created replica set)
Command : kubectl scale --replicas=10 rs -n (Can edit the desire state with command line instead of editing the .yamfile)

Top comments (0)