Create a resource from a file or from stdin.
$ kubectl create -f FILENAME
Command to check the kubernetes nodes:
$ kubectl status nodes
You can check the events in case container creation is being delayed.
$ kubectl get events
To get list of services running
$ kubectl get svc
Cluster Introspection:
=====================
# Get version information
$ kubectl version
# Get cluster information
$kubectl cluster-info
# Get the configuration
$ kubectl config view
# Output information about a node
$ kubectl describe node <node>
Cron-Jobs:
==========
After creating the cron job, get its status using this command:
$ kubectl get cronjob <jobname>
Watch for the job to be created in around one minute:
$ kubectl get jobs --watch
When you don’t need a cron job any more, delete it with
$ kubectl delete cronjob <cronjob name>
$ kubectl delete cronjob <cronjob name>
Labels:
=======
kubectl get pods --show-labels
kubectl logs <podname>/<containername>
Logging:
=======
# Return a snapshot of the logs from pod <pod-name>.
kubectl logs <pod-name>
# Start streaming the logs from pod <pod-name>. This is similar to the 'tail -f' Linux command.
kubectl logs -f <pod-name>
kubectl logs --tail=5 <podname> -c <Container-name>
NameSpaces:
==========
To list namespaced objects such as our pod:
$ kubectl get pods --namespace=test
You can remove the namespace (and everything inside) with:
$ kubectl delete ns test
Describe a NAmespace:
$ kubectl describe ns default
List All namespace:
$ kubectl get ns
Draining a Node:
===============
$ kubectl drain NODE
No comments:
Post a Comment