kubectlbook: remove $ from exec examples
This commit is contained in:
		
							parent
							
								
									dfc93f10de
								
							
						
					
					
						commit
						1090bf82c3
					
				|  | @ -27,7 +27,7 @@ List the contexts in the kubeconfig file | ||||||
| 
 | 
 | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| ```sh | ```sh | ||||||
| $ kubectl config get-contexts | deploykubectl config get-contexts | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```sh | ```sh | ||||||
|  | @ -47,7 +47,7 @@ Print information about the current context | ||||||
| 
 | 
 | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| ```sh | ```sh | ||||||
| $ kubectl config --kubeconfig=config-demo view --minify | deploykubectl config --kubeconfig=config-demo view --minify | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```yaml | ```yaml | ||||||
|  | @ -87,7 +87,7 @@ the name of the context. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```sh | ```sh | ||||||
| $ export CLUSTER=us-west2-c; kubectl apply -k ${CLUSTER} --context=${CLUSTER} | deployexport CLUSTER=us-west2-c; kubectl apply -k ${CLUSTER} --context=${CLUSTER} | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -105,9 +105,9 @@ the name of the context. | ||||||
| 
 | 
 | ||||||
| ```sh | ```sh | ||||||
| # change the context to us-west2-c | # change the context to us-west2-c | ||||||
| $ kubectl config use-context us-west2-c | deploykubectl config use-context us-west2-c | ||||||
| # deploy Resources from the ./us-west2-c/kustomization.yaml | # deploy Resources from the ./us-west2-c/kustomization.yaml | ||||||
| $ kubectl apply -k ./us-west2-c | deploykubectl apply -k ./us-west2-c | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -125,7 +125,7 @@ the name of the directory containing the kubeconfig. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```sh | ```sh | ||||||
| $ kubectl apply -k ./us-west2-c --kubeconfig /path/to/us-west2-c/config | deploykubectl apply -k ./us-west2-c --kubeconfig /path/to/us-west2-c/config | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ made by Apply. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```sh | ```sh | ||||||
| $ kubectl diff -k ./dir/ | deploykubectl diff -k ./dir/ | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -33,7 +33,7 @@ By default, the "diff" command available in your path will be run with "-u" (uni | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```sh | ```sh | ||||||
| $ export KUBECTL_EXTERNAL_DIFF=meld; kubectl diff -k ./dir/ | deployexport KUBECTL_EXTERNAL_DIFF=meld; kubectl diff -k ./dir/ | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  |  | ||||||
|  | @ -83,7 +83,7 @@ Techniques: | ||||||
| **Base Branch:** | **Base Branch:** | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── bases | ├── bases | ||||||
| │   ├── ... | │   ├── ... | ||||||
|  | @ -113,7 +113,7 @@ $ tree | ||||||
| **Deploy Branches:** | **Deploy Branches:** | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── bases # From Base Branch | ├── bases # From Base Branch | ||||||
| │   ├── ... | │   ├── ... | ||||||
|  | @ -129,7 +129,7 @@ $ tree | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── bases # From Base Branch | ├── bases # From Base Branch | ||||||
| │   ├── ... | │   ├── ... | ||||||
|  | @ -141,7 +141,7 @@ $ tree | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── bases # From Base Branch | ├── bases # From Base Branch | ||||||
| │   ├── ... | │   ├── ... | ||||||
|  | @ -196,7 +196,7 @@ Techniques: | ||||||
| **Base Branch:** | **Base Branch:** | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── bases | ├── bases | ||||||
| │   ├── ... | │   ├── ... | ||||||
|  | @ -226,7 +226,7 @@ $ tree | ||||||
| **Deploy Branches:** | **Deploy Branches:** | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| └── deploy-prod | └── deploy-prod | ||||||
|     ├── us-central |     ├── us-central | ||||||
|  | @ -238,7 +238,7 @@ $ tree | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| └── deploy-staging | └── deploy-staging | ||||||
|     └── us-west |     └── us-west | ||||||
|  | @ -246,7 +246,7 @@ $ tree | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| └── deploy-test | └── deploy-test | ||||||
|     └── us-west |     └── us-west | ||||||
|  |  | ||||||
|  | @ -72,7 +72,7 @@ Techniques: | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── bases # Used as a Base only | ├── bases # Used as a Base only | ||||||
| │   ├── kustomization.yaml | │   ├── kustomization.yaml | ||||||
|  |  | ||||||
|  | @ -77,7 +77,7 @@ Techniques: | ||||||
| **Base Repository:** | **Base Repository:** | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── bases # Used as a Base only | ├── bases # Used as a Base only | ||||||
| │   ├── kustomization.yaml | │   ├── kustomization.yaml | ||||||
|  | @ -124,7 +124,7 @@ $ tree | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # sre team | # sre team | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── prod | ├── prod | ||||||
| │   ├── us-central | │   ├── us-central | ||||||
|  | @ -137,7 +137,7 @@ $ tree | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # qa team | # qa team | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| ├── staging # Staging | ├── staging # Staging | ||||||
| │   └── us-west  | │   └── us-west  | ||||||
|  | @ -146,7 +146,7 @@ $ tree | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # dev team | # dev team | ||||||
| $ tree | deploytree | ||||||
| . | . | ||||||
| └── test # Test | └── test # Test | ||||||
|     └── us-west  |     └── us-west  | ||||||
|  |  | ||||||
|  | @ -72,10 +72,10 @@ ResourceConfig files using `-f`. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| ```bash | ```bash | ||||||
| # Apply the Resource Config | # Apply the Resource Config | ||||||
| $ kubectl apply -k . | deploykubectl apply -k . | ||||||
| 
 | 
 | ||||||
| # View the Resources | # View the Resources | ||||||
| $ kubectl get -k . | deploykubectl get -k . | ||||||
| ``` | ``` | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -165,8 +165,8 @@ download the [kustomize standalone](https://github.com/kubernetes-sigs/kustomize | ||||||
| 
 | 
 | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| ```bash | ```bash | ||||||
| $ kustomize edit set imagetag foo:$(git log -n 1 --pretty=format:"%H") | deploykustomize edit set imagetag foo:$(git log -n 1 --pretty=format:"%H") | ||||||
| $ kubectl apply -f . | deploykubectl apply -f . | ||||||
| ``` | ``` | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
| 
 | 
 | ||||||
|  | @ -179,8 +179,8 @@ It is also possible to set a Tag from an environment variable using the same tec | ||||||
| 
 | 
 | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| ```bash | ```bash | ||||||
| $ kustomize edit set image foo:$FOO_IMAGE_TAG | deploykustomize edit set image foo:$FOO_IMAGE_TAG | ||||||
| $ kubectl apply -f . | deploykubectl apply -f . | ||||||
| ``` | ``` | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ Print the logs for a Pod running a single Container | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl logs echo-c6bc8ccff-nnj52 | deploykubectl logs echo-c6bc8ccff-nnj52 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -42,7 +42,7 @@ Print the logs for all Pods for a Workload | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Print logs from all containers matching label | # Print logs from all containers matching label | ||||||
| $ kubectl logs -l app=nginx | deploykubectl logs -l app=nginx | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -65,7 +65,7 @@ Stream logs from a container. | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Follow logs from container | # Follow logs from container | ||||||
| $ kubectl logs nginx-78f5d695bd-czm8z -f | deploykubectl logs nginx-78f5d695bd-czm8z -f | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -81,7 +81,7 @@ crashed or are crash looping. | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Print logs from exited container | # Print logs from exited container | ||||||
| $ kubectl logs nginx-78f5d695bd-czm8z -p | deploykubectl logs nginx-78f5d695bd-czm8z -p | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -97,7 +97,7 @@ containers. | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Print logs from the nginx container in the nginx-78f5d695bd-czm8z Pod | # Print logs from the nginx container in the nginx-78f5d695bd-czm8z Pod | ||||||
| $ kubectl logs nginx-78f5d695bd-czm8z -c nginx | deploykubectl logs nginx-78f5d695bd-czm8z -c nginx | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -112,7 +112,7 @@ Print the logs that occurred after an absolute time. | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Print logs since a date | # Print logs since a date | ||||||
| $ kubectl logs nginx-78f5d695bd-czm8z --since-time=2018-11-01T15:00:00Z | deploykubectl logs nginx-78f5d695bd-czm8z --since-time=2018-11-01T15:00:00Z | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -134,7 +134,7 @@ Examples: | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Print logs for the past hour | # Print logs for the past hour | ||||||
| $ kubectl logs nginx-78f5d695bd-czm8z --since=1h | deploykubectl logs nginx-78f5d695bd-czm8z --since=1h | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -150,7 +150,7 @@ Include timestamps in the log lines | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Print logs with timestamps | # Print logs with timestamps | ||||||
| $ kubectl logs -l app=echo --timestamps | deploykubectl logs -l app=echo --timestamps | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ Copy a local file to a remote Pod in a cluster. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir | deploykubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -40,7 +40,7 @@ Copy a remote file from a Pod to a local file. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl cp /tmp/foo <some-pod>:/tmp/bar | deploykubectl cp /tmp/foo <some-pod>:/tmp/bar | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -55,7 +55,7 @@ Specify the Container within a Pod running multiple containers. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container> | deploykubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container> | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -70,7 +70,7 @@ Set the Pod namespace by prefixing the Pod name with `<namespace>/` . | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar | deploykubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ To get a Shell in a Container, use the `-t -i` options to get a tty and attach S | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl exec -t -i nginx-78f5d695bd-czm8z bash | deploykubectl exec -t -i nginx-78f5d695bd-czm8z bash | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 60 | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl port-forward pod/mypod 5000 6000 | deploykubectl port-forward pod/mypod 5000 6000 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -30,7 +30,7 @@ deployment | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl port-forward deployment/mydeployment 5000 6000 | deploykubectl port-forward deployment/mydeployment 5000 6000 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -44,7 +44,7 @@ Listen on port 8888 locally, forwarding to 5000 in the pod | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl port-forward pod/mypod 8888:5000 | deploykubectl port-forward pod/mypod 8888:5000 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -58,7 +58,7 @@ Listen on a random port locally, forwarding to 5000 in the pod | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl port-forward pod/mypod :5000 | deploykubectl port-forward pod/mypod :5000 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -74,7 +74,7 @@ Specify the Container within a Pod running multiple containers. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container> | deploykubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container> | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -90,7 +90,7 @@ Set the Pod namespace by prefixing the Pod name with `<namespace>/` . | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar | deploykubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  |  | ||||||
|  | @ -28,13 +28,13 @@ To visit the nginx service go to the Proxy URL at | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl proxy | deploykubectl proxy | ||||||
| 
 | 
 | ||||||
| Starting to serve on 127.0.0.1:8001 | Starting to serve on 127.0.0.1:8001 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ curl http://127.0.0.1:8001/api/v1/namespaces/default/services/nginx/proxy/ | deploycurl http://127.0.0.1:8001/api/v1/namespaces/default/services/nginx/proxy/ | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -56,7 +56,7 @@ A common usecase is to connect to Services running as part of the cluster itself | ||||||
| Services and their Proxy Urls with `kubectl cluster-info`. | Services and their Proxy Urls with `kubectl cluster-info`. | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl cluster-info | deploykubectl cluster-info | ||||||
| 
 | 
 | ||||||
| Kubernetes master is running at https://104.197.5.247 | Kubernetes master is running at https://104.197.5.247 | ||||||
| GLBCDefaultBackend is running at https://104.197.5.247/api/v1/namespaces/kube-system/services/default-http-backend:http/proxy | GLBCDefaultBackend is running at https://104.197.5.247/api/v1/namespaces/kube-system/services/default-http-backend:http/proxy | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ source. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl version | deploykubectl version | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -49,7 +49,7 @@ add-ons. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl cluster-info | deploykubectl cluster-info | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -78,7 +78,7 @@ top nodes and pods. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl top node | deploykubectl top node | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -104,7 +104,7 @@ Print the Resource Types available in the cluster. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl api-resources | deploykubectl api-resources | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -127,7 +127,7 @@ Print the API versions available in the cluster. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl api-versions | deploykubectl api-versions | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -159,7 +159,7 @@ Resource types.  This is useful for learning about the type. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl explain deployment --api-version apps/v1 | deploykubectl explain deployment --api-version apps/v1 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ Resources, and formats and prints this information on multiple lines. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl describe deployments | deploykubectl describe deployments | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  |  | ||||||
|  | @ -68,7 +68,7 @@ Print the JSON representation of the first Deployment in the list on a single li | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment.v1.apps -o=jsonpath='{.items[0]}{"\n"}' | deploykubectl get deployment.v1.apps -o=jsonpath='{.items[0]}{"\n"}' | ||||||
| 
 | 
 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | @ -86,7 +86,7 @@ Print the `metadata.name` field for the first Deployment in the list. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment.v1.apps -o=jsonpath='{.items[0].metadata.name}{"\n"}' | deploykubectl get deployment.v1.apps -o=jsonpath='{.items[0].metadata.name}{"\n"}' | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -104,7 +104,7 @@ For each Deployment, print its `metadata.name` field and a newline afterward. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment.v1.apps -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | deploykubectl get deployment.v1.apps -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -123,7 +123,7 @@ For each Deployment, print its `metadata.name` and `.status.availableReplicas`. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment.v1.apps -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.availableReplicas}{"\n"}{end}' | deploykubectl get deployment.v1.apps -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.availableReplicas}{"\n"}{end}' | ||||||
| ``` | ``` | ||||||
| ```bash | ```bash | ||||||
| nginx	1 | nginx	1 | ||||||
|  | @ -141,7 +141,7 @@ Print the list of Deployments as single line. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment.v1.apps -o=jsonpath='{@}{"\n"}' | deploykubectl get deployment.v1.apps -o=jsonpath='{@}{"\n"}' | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -159,7 +159,7 @@ Print each Deployment on a new line. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment.v1.apps -o=jsonpath='{range .items[*]}{@}{"\n"}{end}' | deploykubectl get deployment.v1.apps -o=jsonpath='{range .items[*]}{@}{"\n"}{end}' | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ Get all Resources provided by the `kustomization.yaml` in project/. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get -k project/ | deploykubectl get -k project/ | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -27,7 +27,7 @@ Get all Resources present in the Resource Config for a directory. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get -f configs/ | deploykubectl get -f configs/ | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -44,17 +44,17 @@ The Singular, Plural, Short Name also apply to *Types with Name* and *Types with | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Plural | # Plural | ||||||
| $ kubectl get deployments | deploykubectl get deployments | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Singular | # Singular | ||||||
| $ kubectl get deployment | deploykubectl get deployment | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| # Short name | # Short name | ||||||
| $ kubectl get deploy | deploykubectl get deploy | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -69,11 +69,11 @@ The Group and Version for the Resource are explicit. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments.apps | deploykubectl get deployments.apps | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments.v1.apps | deploykubectl get deployments.v1.apps | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -86,7 +86,7 @@ Get named Resources in a namespace for a given type. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment nginx | deploykubectl get deployment nginx | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -98,7 +98,7 @@ Get **all** Resources in a namespace **matching a label select** for a given typ | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments -l app=nginx | deploykubectl get deployments -l app=nginx | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -114,7 +114,7 @@ The `---all-namespaces` flag will **fetch Resources from all namespaces**. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments --all-namespaces | deploykubectl get deployments --all-namespaces | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -128,7 +128,7 @@ Get and Describe can accept **multiple Resource types**, and it will print them | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments,services | deploykubectl get deployments,services | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -142,7 +142,7 @@ Get and Describe can accept **multiple Resource types and names**. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get kubectl get rc/web service/frontend pods/web-pod-13je7 | deploykubectl get kubectl get rc/web service/frontend pods/web-pod-13je7 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -156,7 +156,7 @@ These Resources can be view with the `--include-uninitialized` flag. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments --include-uninitialized | deploykubectl get deployments --include-uninitialized | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  | @ -170,7 +170,7 @@ The `--ignore-not-found` flag will cause kubectl to exit 0 if the Resource is no | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment nginx --ignore-not-found | deploykubectl get deployment nginx --ignore-not-found | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| {% endmethod %} | {% endmethod %} | ||||||
|  |  | ||||||
|  | @ -32,7 +32,7 @@ Print the Raw Resource formatting it as YAML. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments -o yaml | deploykubectl get deployments -o yaml | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```yaml | ```yaml | ||||||
|  | @ -120,7 +120,7 @@ Print the Raw Resource formatting it as JSON. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments -o json | deploykubectl get deployments -o json | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```json | ```json | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ be a summary of fields. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments nginx | deploykubectl get deployments nginx | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -52,7 +52,7 @@ be a summary of fields. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get -o=wide deployments nginx | deploykubectl get -o=wide deployments nginx | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -74,7 +74,7 @@ Print out specific fields as Columns. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments -o custom-columns="Name:metadata.name,Replicas:spec.replicas,Strategy:spec.strategy.type" | deploykubectl get deployments -o custom-columns="Name:metadata.name,Replicas:spec.replicas,Strategy:spec.strategy.type" | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -112,7 +112,7 @@ Print out all labels on each Resource in a single column (last). | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployment --show-labels | deploykubectl get deployment --show-labels | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  | @ -135,7 +135,7 @@ they want to know which API is being used. | ||||||
| {% sample lang="yaml" %} | {% sample lang="yaml" %} | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| $ kubectl get deployments --show-kind | deploykubectl get deployments --show-kind | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue