Monday, 21 October 2024

kubernetes commands & keywords

Cluster Management

Display endpoint information about the master and services in the cluster kubectl cluster-info

Display the Kubernetes version running on the client and server kubectl version

Get the configuration of the cluster kubectl config view

List the API resources that are available kubectl api-resources

Daemonsets Shortcode = ds

List everything kubectl get all --all-namespaces

List one or more daemonsets kubectl get daemonset

Edit and update the definition of one or more daemonset kubectl edit daemonset

Delete a daemonset kubectl delete daemonset

Create a new daemonset kubectl create daemonset

Manage the rollout of a daemonset kubectl rollout daemonset

Display the detailed state of daemonsets within a namespace kubectl describe ds -n Deployments Shortcode = deploy

List one or more deployments kubectl get deploymen

Display the detailed state of one or more deployments kubectl describe deployment

Edit and update the definition of one or more deployment on the server kubectl create deployment

Delete deployments kubectl delete deployment Events Shortcode = ev

List recent events for all resources in the system kubectl get event

List Warnings only kubectl get events --field-selector type=Warning

List events but exclude Pod events kubectl get events --field-selector involvedObject.kind!=Pod

Pull events for a single node with a specific name kubectl get events --field-selector involvedObject.kind=Node, involvedObject.name=

Filter out normal events from a list of events kubectl get events --field-selector type!=Nor

mal

L

ogs

P

rint the logs for a pod kubectl logs

Print the logs for the last hour for a pod kubectl logs --since=1h Get the most recent 20 lines of logs ubectl logs --tail=20

Get logs from a service and optionally select which container kubectl logs -f [-c <$container>]

Print the logs for a pod and follow new logs kubectl logs -f

Print the logs for a container in a pod kubectl logs -c

View the logs for a previously failed pod kubectl logs --previous

Get logs for all pods named with pod_prefix kubetail

Include the most recent 5 minutes of logs kubetail -s 5m

Display Resource usage (CPU/Memory/Storage) for pods. kubectl top pod

Add or update the annotations of a pod. kubectl annotate pod

Add or update the label of a pod. kubectl label pods new-label=

No comments:

Post a Comment

devops interview questions

Terraform* 1. Terraform workspace 2. ⁠what are Mera arguments 3. ⁠what’s difference b/w for each and dynamic block 4. ⁠provisioners in t...