Kubernetes Basics
Kubernetes Basics
Installing kubectl in linux
- curl -LO https://storage.googleapis.com
/kubernetes-release/release/v1 .7.0/bin/linux/amd64/kubectl - chmod +x ./kubectl
- sudo mv ./kubectl /usr/local/bin/kubectl
Note Windows users can follow this link https://kubernetes.io/doc s/tasks/tools/install-kubectl/
Configure k8s cluster for CLI
- Create .kube folder in your home folder.
- store your private key in .kube folder and name it as config
you can get the config files from AIL drive.
Accessing k8s cluster
- kubectl cluster-info
Get the nodes (minions) list
- kubectl get nodes
Get the deployment lists in k8s
- kubectl get deployment
Get the pods list
- kubectl get pods
Get the replication controller list
- kubectl get rc
Describe pod
- kubectl describe pod zatanna-2918509718-6aty9
Get the service list
- kubectl get svc
Some times you are not able to view the entire endpoint URL. Use the below one to get the entire URL.
- kubectl get svc -o wide
you can use -o wide to get the wide view of the output.
Describe service
- kubectl describe svc zatanna
Get logs from pod
- kubectl logs zatanna-2918509718-6aty9
follow the logs
- kubectl logs -f zatanna-2918509718-6aty9
Login to the pod
- kubectl exec -it zatanna-2918509718-6aty9 /bin/bash
Get the pod resource utilization
- kubectl top pod zatanna-2918509718-6aty9
Deploy a new service in kubernetes
- kubectl create -f nginx.yaml
Comments
Post a Comment