Basic Information
Summary of the course Kubernetes Certified Application Developer (CKAD) with Tests.
Kubernetes official documentation: Kubernetes Documentation
Formatting Output with kubectl
To format the output of kubectl
commands, you can use the -o
or --output
flag followed by the desired output format. Common output formats include:
json
: Outputs the resource in JSON format.yaml
: Outputs the resource in YAML format.wide
: Outputs additional information in a table format.
Example: Get Pods in YAML Format
kubectl get pods -o yaml
Example: Get Services in JSON Format
kubectl get services -o json
Example: Get Nodes in Wide Format
kubectl get nodes -o wide
watch
To continuously watch for changes in resources, you can use the --watch
or -w
flag. This will keep the command running and update the output as changes occur.
kubectl get pods --watch