From dfc93f10de20f810b6851ed2e9911a3a16e240d8 Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Wed, 13 Mar 2019 08:44:35 -0700 Subject: [PATCH 1/2] kubectl book - add `newName` function - update the customizing pod template with `newName` --- .../customizing_pod_templates.md | 16 ++++++--- .../pages/app_management/container_images.md | 36 +++++++++++++++---- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/docs/book/pages/app_customization/customizing_pod_templates.md b/docs/book/pages/app_customization/customizing_pod_templates.md index 5c7a50c0f..3f93b7e34 100644 --- a/docs/book/pages/app_customization/customizing_pod_templates.md +++ b/docs/book/pages/app_customization/customizing_pod_templates.md @@ -1,5 +1,5 @@ {% panel style="info", title="TL;DR" %} -- Override Base Pod and PodTemplate Image Tags +- Override Base Pod and PodTemplate Image **Names** and **Tags** - Override Base Pod and PodTemplate Environment Variables and Arguments {% endpanel %} @@ -21,9 +21,14 @@ Common examples include: {% method %} **Use Case:** Different Environments (test, dev, staging, canary, prod) use images with different tags. -Override the tag for an `image` field from a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/#pod-templates) -in a base by specifying the `images` field in the `kustomization.yaml`. The `newTag` may -be specified to override the image tag for images whose image name matches `name`. +Override the name or tag for an `image` field from a [Pod Template](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/#pod-templates) +in a base by specifying the `images` field in the `kustomization.yaml`. + +| Field | Description | Example Field | Example Result | +|-----------|--------------------------------------------------------------------------|----------| --- | +| `name` | Match images with this image name| `name: nginx`| | +| `newTag` | Override the image **tag** or **digest** for images whose image name matches `name` | `newTag: new` | `nginx:old` -> `nginx:new` | +| `newName` | Override the image **name** for images whose image name matches `name` | `newImage: nginx-special` | `nginx:old` -> `nginx-special:old` | {% sample lang="yaml" %} **Input:** The `kustomization.yaml` file @@ -35,6 +40,7 @@ bases: images: - name: nginx-pod newTag: 1.15 + newName: nginx-pod-2 ``` **Base:** Resources to be modified by the `kustomization.yaml` @@ -89,7 +95,7 @@ spec: containers: # The image image tag has been changed for the container - name: nginx - image: nginx-pod:1.15 + image: nginx-pod-2:1.15 ``` {% endmethod %} diff --git a/docs/book/pages/app_management/container_images.md b/docs/book/pages/app_management/container_images.md index 1c8ecb4a0..b774c72b6 100644 --- a/docs/book/pages/app_management/container_images.md +++ b/docs/book/pages/app_management/container_images.md @@ -1,5 +1,5 @@ {% panel style="info", title="TL;DR" %} -- Override or set the Tag for Container Images +- Override or set the Name and Tag for Container Images {% endpanel %} # Container Images @@ -9,7 +9,7 @@ It may be useful to define the tags of container images which are used across many Workloads. -- Update the container image tag for multiple Workloads at once +- Update the container image name or tag for multiple Workloads at once - Increase visibility of the versions of container images being used within the project - Set the image tag from external sources - such as environment variables @@ -25,13 +25,21 @@ the `kustomization.yaml` using the `images` field. When `images` are specified, Apply will override the images whose image name matches `name` with a new tag. + +| Field | Description | Example Field | Example Result | +|-----------|--------------------------------------------------------------------------|----------| --- | +| `name` | Match images with this image name| `name: nginx`| | +| `newTag` | Override the image **tag** or **digest** for images whose image name matches `name` | `newTag: new` | `nginx:old` -> `nginx:new` | +| `newName` | Override the image **name** for images whose image name matches `name` | `newImage: nginx-special` | `nginx:old` -> `nginx-special:old` | + {% method %} **Example:** Use `images` in the `kustomization.yaml` to update the container images in `deployment.yaml` -Apply will set the `nginx` image to have the tag `1.8.0` - e.g. `nginx:1.8.0`. -This will set the tag for *all* images matching the *name*. +Apply will set the `nginx` image to have the tag `1.8.0` - e.g. `nginx:1.8.0` and +change the image name to `nginx-special`. +This will set the name and tag for *all* images matching the *name*. {% sample lang="yaml" %} **Input:** The kustomization.yaml and deployment.yaml files @@ -43,6 +51,7 @@ kind: Kustomization images: - name: nginx # match images with this name newTag: 1.8.0 # override the tag + newName: nginx-special # override the name resources: - deployment.yaml ``` @@ -88,13 +97,28 @@ spec: app: nginx spec: containers: - # The image has been changed to include the tag - - image: nginx:1.8.0 + # The image has been changed + - image: nginx-special:1.8.0 name: nginx ``` {% endmethod %} +## Setting a Name + +{% method %} +The name for an image may be set by specifying `newName` and the name of the old container image. +{% sample lang="yaml" %} +```yaml +# kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +images: + - name: mycontainerregistry/myimage + newName: differentregistry/myimage +``` +{% endmethod %} + ## Setting a Tag {% method %} From 1090bf82c31e52d812984db5e89a108b535b1deb Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Thu, 14 Mar 2019 16:48:30 -0700 Subject: [PATCH 2/2] kubectlbook: remove $ from exec examples --- .../accessing_multiple_clusters.md | 12 ++++---- .../diffing_local_and_remote_resources.md | 4 +-- .../structure_branches.md | 16 +++++------ .../structure_directories.md | 2 +- .../structure_repositories.md | 8 +++--- docs/book/pages/app_management/apply.md | 4 +-- .../pages/app_management/container_images.md | 8 +++--- .../container_debugging/container_logs.md | 16 +++++------ .../copying_container_files.md | 8 +++--- .../executing_a_command_in_a_container.md | 2 +- .../port_forward_to_pods.md | 12 ++++---- .../proxying_traffic_to_services.md | 6 ++-- .../resource_printing/cluster_information.md | 12 ++++---- docs/book/pages/resource_printing/describe.md | 2 +- docs/book/pages/resource_printing/fields.md | 12 ++++---- .../resource_printing/queries_and_options.md | 28 +++++++++---------- docs/book/pages/resource_printing/raw.md | 4 +-- .../book/pages/resource_printing/summaries.md | 10 +++---- 18 files changed, 83 insertions(+), 83 deletions(-) diff --git a/docs/book/pages/app_composition_and_deployment/accessing_multiple_clusters.md b/docs/book/pages/app_composition_and_deployment/accessing_multiple_clusters.md index 27c04829e..221a1cb3c 100644 --- a/docs/book/pages/app_composition_and_deployment/accessing_multiple_clusters.md +++ b/docs/book/pages/app_composition_and_deployment/accessing_multiple_clusters.md @@ -27,7 +27,7 @@ List the contexts in the kubeconfig file {% sample lang="yaml" %} ```sh -$ kubectl config get-contexts +deploykubectl config get-contexts ``` ```sh @@ -47,7 +47,7 @@ Print information about the current context {% sample lang="yaml" %} ```sh -$ kubectl config --kubeconfig=config-demo view --minify +deploykubectl config --kubeconfig=config-demo view --minify ``` ```yaml @@ -87,7 +87,7 @@ the name of the context. {% sample lang="yaml" %} ```sh -$ export CLUSTER=us-west2-c; kubectl apply -k ${CLUSTER} --context=${CLUSTER} +deployexport CLUSTER=us-west2-c; kubectl apply -k ${CLUSTER} --context=${CLUSTER} ``` {% endmethod %} @@ -105,9 +105,9 @@ the name of the context. ```sh # 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 -$ kubectl apply -k ./us-west2-c +deploykubectl apply -k ./us-west2-c ``` {% endmethod %} @@ -125,7 +125,7 @@ the name of the directory containing the kubeconfig. {% sample lang="yaml" %} ```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 %} diff --git a/docs/book/pages/app_composition_and_deployment/diffing_local_and_remote_resources.md b/docs/book/pages/app_composition_and_deployment/diffing_local_and_remote_resources.md index 6c768df8c..24bfb81f1 100644 --- a/docs/book/pages/app_composition_and_deployment/diffing_local_and_remote_resources.md +++ b/docs/book/pages/app_composition_and_deployment/diffing_local_and_remote_resources.md @@ -17,7 +17,7 @@ made by Apply. {% sample lang="yaml" %} ```sh -$ kubectl diff -k ./dir/ +deploykubectl diff -k ./dir/ ``` {% endmethod %} @@ -33,7 +33,7 @@ By default, the "diff" command available in your path will be run with "-u" (uni {% sample lang="yaml" %} ```sh -$ export KUBECTL_EXTERNAL_DIFF=meld; kubectl diff -k ./dir/ +deployexport KUBECTL_EXTERNAL_DIFF=meld; kubectl diff -k ./dir/ ``` {% endmethod %} diff --git a/docs/book/pages/app_composition_and_deployment/structure_branches.md b/docs/book/pages/app_composition_and_deployment/structure_branches.md index f8fb7b882..3e100e1fb 100644 --- a/docs/book/pages/app_composition_and_deployment/structure_branches.md +++ b/docs/book/pages/app_composition_and_deployment/structure_branches.md @@ -83,7 +83,7 @@ Techniques: **Base Branch:** ```bash -$ tree +deploytree . ├── bases │   ├── ... @@ -113,7 +113,7 @@ $ tree **Deploy Branches:** ```bash -$ tree +deploytree . ├── bases # From Base Branch │   ├── ... @@ -129,7 +129,7 @@ $ tree ``` ```bash -$ tree +deploytree . ├── bases # From Base Branch │   ├── ... @@ -141,7 +141,7 @@ $ tree ``` ```bash -$ tree +deploytree . ├── bases # From Base Branch │   ├── ... @@ -196,7 +196,7 @@ Techniques: **Base Branch:** ```bash -$ tree +deploytree . ├── bases │   ├── ... @@ -226,7 +226,7 @@ $ tree **Deploy Branches:** ```bash -$ tree +deploytree . └── deploy-prod    ├── us-central @@ -238,7 +238,7 @@ $ tree ``` ```bash -$ tree +deploytree . └── deploy-staging └── us-west @@ -246,7 +246,7 @@ $ tree ``` ```bash -$ tree +deploytree . └── deploy-test └── us-west diff --git a/docs/book/pages/app_composition_and_deployment/structure_directories.md b/docs/book/pages/app_composition_and_deployment/structure_directories.md index 94b9d716f..b6a1a2234 100644 --- a/docs/book/pages/app_composition_and_deployment/structure_directories.md +++ b/docs/book/pages/app_composition_and_deployment/structure_directories.md @@ -72,7 +72,7 @@ Techniques: {% sample lang="yaml" %} ```bash -$ tree +deploytree . ├── bases # Used as a Base only │   ├── kustomization.yaml diff --git a/docs/book/pages/app_composition_and_deployment/structure_repositories.md b/docs/book/pages/app_composition_and_deployment/structure_repositories.md index 92b044c83..486b2bf14 100644 --- a/docs/book/pages/app_composition_and_deployment/structure_repositories.md +++ b/docs/book/pages/app_composition_and_deployment/structure_repositories.md @@ -77,7 +77,7 @@ Techniques: **Base Repository:** ```bash -$ tree +deploytree . ├── bases # Used as a Base only │   ├── kustomization.yaml @@ -124,7 +124,7 @@ $ tree ```bash # sre team -$ tree +deploytree . ├── prod │   ├── us-central @@ -137,7 +137,7 @@ $ tree ```bash # qa team -$ tree +deploytree . ├── staging # Staging │   └── us-west @@ -146,7 +146,7 @@ $ tree ```bash # dev team -$ tree +deploytree . └── test # Test └── us-west diff --git a/docs/book/pages/app_management/apply.md b/docs/book/pages/app_management/apply.md index 04f5cdb6d..49def6d07 100644 --- a/docs/book/pages/app_management/apply.md +++ b/docs/book/pages/app_management/apply.md @@ -72,10 +72,10 @@ ResourceConfig files using `-f`. {% sample lang="yaml" %} ```bash # Apply the Resource Config -$ kubectl apply -k . +deploykubectl apply -k . # View the Resources -$ kubectl get -k . +deploykubectl get -k . ``` {% endmethod %} diff --git a/docs/book/pages/app_management/container_images.md b/docs/book/pages/app_management/container_images.md index b774c72b6..82e22258f 100644 --- a/docs/book/pages/app_management/container_images.md +++ b/docs/book/pages/app_management/container_images.md @@ -165,8 +165,8 @@ download the [kustomize standalone](https://github.com/kubernetes-sigs/kustomize {% sample lang="yaml" %} ```bash -$ kustomize edit set imagetag foo:$(git log -n 1 --pretty=format:"%H") -$ kubectl apply -f . +deploykustomize edit set imagetag foo:$(git log -n 1 --pretty=format:"%H") +deploykubectl apply -f . ``` {% endmethod %} @@ -179,8 +179,8 @@ It is also possible to set a Tag from an environment variable using the same tec {% sample lang="yaml" %} ```bash -$ kustomize edit set image foo:$FOO_IMAGE_TAG -$ kubectl apply -f . +deploykustomize edit set image foo:$FOO_IMAGE_TAG +deploykubectl apply -f . ``` {% endmethod %} diff --git a/docs/book/pages/container_debugging/container_logs.md b/docs/book/pages/container_debugging/container_logs.md index 4d08d4e85..0ca62c637 100644 --- a/docs/book/pages/container_debugging/container_logs.md +++ b/docs/book/pages/container_debugging/container_logs.md @@ -15,7 +15,7 @@ Print the logs for a Pod running a single Container {% sample lang="yaml" %} ```bash -$ kubectl logs echo-c6bc8ccff-nnj52 +deploykubectl logs echo-c6bc8ccff-nnj52 ``` ```bash @@ -42,7 +42,7 @@ Print the logs for all Pods for a Workload ```bash # Print logs from all containers matching label -$ kubectl logs -l app=nginx +deploykubectl logs -l app=nginx ``` {% endmethod %} @@ -65,7 +65,7 @@ Stream logs from a container. ```bash # Follow logs from container -$ kubectl logs nginx-78f5d695bd-czm8z -f +deploykubectl logs nginx-78f5d695bd-czm8z -f ``` {% endmethod %} @@ -81,7 +81,7 @@ crashed or are crash looping. ```bash # Print logs from exited container -$ kubectl logs nginx-78f5d695bd-czm8z -p +deploykubectl logs nginx-78f5d695bd-czm8z -p ``` {% endmethod %} @@ -97,7 +97,7 @@ containers. ```bash # 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 %} @@ -112,7 +112,7 @@ Print the logs that occurred after an absolute time. ```bash # 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 %} @@ -134,7 +134,7 @@ Examples: ```bash # Print logs for the past hour -$ kubectl logs nginx-78f5d695bd-czm8z --since=1h +deploykubectl logs nginx-78f5d695bd-czm8z --since=1h ``` {% endmethod %} @@ -150,7 +150,7 @@ Include timestamps in the log lines ```bash # Print logs with timestamps -$ kubectl logs -l app=echo --timestamps +deploykubectl logs -l app=echo --timestamps ``` ```bash diff --git a/docs/book/pages/container_debugging/copying_container_files.md b/docs/book/pages/container_debugging/copying_container_files.md index 96480acb2..221bdd5e1 100644 --- a/docs/book/pages/container_debugging/copying_container_files.md +++ b/docs/book/pages/container_debugging/copying_container_files.md @@ -24,7 +24,7 @@ Copy a local file to a remote Pod in a cluster. {% sample lang="yaml" %} ```bash -$ kubectl cp /tmp/foo_dir :/tmp/bar_dir +deploykubectl cp /tmp/foo_dir :/tmp/bar_dir ``` {% endmethod %} @@ -40,7 +40,7 @@ Copy a remote file from a Pod to a local file. {% sample lang="yaml" %} ```bash -$ kubectl cp /tmp/foo :/tmp/bar +deploykubectl cp /tmp/foo :/tmp/bar ``` {% endmethod %} @@ -55,7 +55,7 @@ Specify the Container within a Pod running multiple containers. {% sample lang="yaml" %} ```bash -$ kubectl cp /tmp/foo :/tmp/bar -c +deploykubectl cp /tmp/foo :/tmp/bar -c ``` {% endmethod %} @@ -70,7 +70,7 @@ Set the Pod namespace by prefixing the Pod name with `/` . {% sample lang="yaml" %} ```bash -$ kubectl cp /tmp/foo /:/tmp/bar +deploykubectl cp /tmp/foo /:/tmp/bar ``` {% endmethod %} diff --git a/docs/book/pages/container_debugging/executing_a_command_in_a_container.md b/docs/book/pages/container_debugging/executing_a_command_in_a_container.md index 1349de13d..27a654637 100644 --- a/docs/book/pages/container_debugging/executing_a_command_in_a_container.md +++ b/docs/book/pages/container_debugging/executing_a_command_in_a_container.md @@ -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" %} ```bash -$ kubectl exec -t -i nginx-78f5d695bd-czm8z bash +deploykubectl exec -t -i nginx-78f5d695bd-czm8z bash ``` ```bash diff --git a/docs/book/pages/container_debugging/port_forward_to_pods.md b/docs/book/pages/container_debugging/port_forward_to_pods.md index c4ad2bfb9..9c949dd73 100644 --- a/docs/book/pages/container_debugging/port_forward_to_pods.md +++ b/docs/book/pages/container_debugging/port_forward_to_pods.md @@ -15,7 +15,7 @@ Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 60 {% sample lang="yaml" %} ```bash -$ kubectl port-forward pod/mypod 5000 6000 +deploykubectl port-forward pod/mypod 5000 6000 ``` {% endmethod %} @@ -30,7 +30,7 @@ deployment {% sample lang="yaml" %} ```bash -$ kubectl port-forward deployment/mydeployment 5000 6000 +deploykubectl port-forward deployment/mydeployment 5000 6000 ``` {% endmethod %} @@ -44,7 +44,7 @@ Listen on port 8888 locally, forwarding to 5000 in the pod {% sample lang="yaml" %} ```bash -$ kubectl port-forward pod/mypod 8888:5000 +deploykubectl port-forward pod/mypod 8888:5000 ``` {% endmethod %} @@ -58,7 +58,7 @@ Listen on a random port locally, forwarding to 5000 in the pod {% sample lang="yaml" %} ```bash -$ kubectl port-forward pod/mypod :5000 +deploykubectl port-forward pod/mypod :5000 ``` {% endmethod %} @@ -74,7 +74,7 @@ Specify the Container within a Pod running multiple containers. {% sample lang="yaml" %} ```bash -$ kubectl cp /tmp/foo :/tmp/bar -c +deploykubectl cp /tmp/foo :/tmp/bar -c ``` {% endmethod %} @@ -90,7 +90,7 @@ Set the Pod namespace by prefixing the Pod name with `/` . {% sample lang="yaml" %} ```bash -$ kubectl cp /tmp/foo /:/tmp/bar +deploykubectl cp /tmp/foo /:/tmp/bar ``` {% endmethod %} diff --git a/docs/book/pages/container_debugging/proxying_traffic_to_services.md b/docs/book/pages/container_debugging/proxying_traffic_to_services.md index 9cc776c7d..631975088 100644 --- a/docs/book/pages/container_debugging/proxying_traffic_to_services.md +++ b/docs/book/pages/container_debugging/proxying_traffic_to_services.md @@ -28,13 +28,13 @@ To visit the nginx service go to the Proxy URL at {% sample lang="yaml" %} ```bash -$ kubectl proxy +deploykubectl proxy Starting to serve on 127.0.0.1:8001 ``` ```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 %} @@ -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`. ```bash -$ kubectl cluster-info +deploykubectl cluster-info 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 diff --git a/docs/book/pages/resource_printing/cluster_information.md b/docs/book/pages/resource_printing/cluster_information.md index 6b88a9053..2984bcaaa 100644 --- a/docs/book/pages/resource_printing/cluster_information.md +++ b/docs/book/pages/resource_printing/cluster_information.md @@ -24,7 +24,7 @@ source. {% sample lang="yaml" %} ```bash -$ kubectl version +deploykubectl version ``` ```bash @@ -49,7 +49,7 @@ add-ons. {% sample lang="yaml" %} ```bash -$ kubectl cluster-info +deploykubectl cluster-info ``` ```bash @@ -78,7 +78,7 @@ top nodes and pods. {% sample lang="yaml" %} ```bash -$ kubectl top node +deploykubectl top node ``` ```bash @@ -104,7 +104,7 @@ Print the Resource Types available in the cluster. {% sample lang="yaml" %} ```bash -$ kubectl api-resources +deploykubectl api-resources ``` ```bash @@ -127,7 +127,7 @@ Print the API versions available in the cluster. {% sample lang="yaml" %} ```bash -$ kubectl api-versions +deploykubectl api-versions ``` ```bash @@ -159,7 +159,7 @@ Resource types. This is useful for learning about the type. {% sample lang="yaml" %} ```bash -$ kubectl explain deployment --api-version apps/v1 +deploykubectl explain deployment --api-version apps/v1 ``` ```bash diff --git a/docs/book/pages/resource_printing/describe.md b/docs/book/pages/resource_printing/describe.md index b82d0feeb..0d1f01b8f 100644 --- a/docs/book/pages/resource_printing/describe.md +++ b/docs/book/pages/resource_printing/describe.md @@ -19,7 +19,7 @@ Resources, and formats and prints this information on multiple lines. {% sample lang="yaml" %} ```bash -$ kubectl describe deployments +deploykubectl describe deployments ``` ```bash diff --git a/docs/book/pages/resource_printing/fields.md b/docs/book/pages/resource_printing/fields.md index e6ed31af6..9d8052e5c 100644 --- a/docs/book/pages/resource_printing/fields.md +++ b/docs/book/pages/resource_printing/fields.md @@ -68,7 +68,7 @@ Print the JSON representation of the first Deployment in the list on a single li {% sample lang="yaml" %} ```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" %} ```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 @@ -104,7 +104,7 @@ For each Deployment, print its `metadata.name` field and a newline afterward. {% sample lang="yaml" %} ```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 @@ -123,7 +123,7 @@ For each Deployment, print its `metadata.name` and `.status.availableReplicas`. {% sample lang="yaml" %} ```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 nginx 1 @@ -141,7 +141,7 @@ Print the list of Deployments as single line. {% sample lang="yaml" %} ```bash -$ kubectl get deployment.v1.apps -o=jsonpath='{@}{"\n"}' +deploykubectl get deployment.v1.apps -o=jsonpath='{@}{"\n"}' ``` ```bash @@ -159,7 +159,7 @@ Print each Deployment on a new line. {% sample lang="yaml" %} ```bash -$ kubectl get deployment.v1.apps -o=jsonpath='{range .items[*]}{@}{"\n"}{end}' +deploykubectl get deployment.v1.apps -o=jsonpath='{range .items[*]}{@}{"\n"}{end}' ``` ```bash diff --git a/docs/book/pages/resource_printing/queries_and_options.md b/docs/book/pages/resource_printing/queries_and_options.md index 7bae90201..844fd7c99 100644 --- a/docs/book/pages/resource_printing/queries_and_options.md +++ b/docs/book/pages/resource_printing/queries_and_options.md @@ -15,7 +15,7 @@ Get all Resources provided by the `kustomization.yaml` in project/. {% sample lang="yaml" %} ```bash -$ kubectl get -k project/ +deploykubectl get -k project/ ``` {% endmethod %} @@ -27,7 +27,7 @@ Get all Resources present in the Resource Config for a directory. {% sample lang="yaml" %} ```bash -$ kubectl get -f configs/ +deploykubectl get -f configs/ ``` {% endmethod %} @@ -44,17 +44,17 @@ The Singular, Plural, Short Name also apply to *Types with Name* and *Types with ```bash # Plural -$ kubectl get deployments +deploykubectl get deployments ``` ```bash # Singular -$ kubectl get deployment +deploykubectl get deployment ``` ```bash # Short name -$ kubectl get deploy +deploykubectl get deploy ``` {% endmethod %} @@ -69,11 +69,11 @@ The Group and Version for the Resource are explicit. {% sample lang="yaml" %} ```bash -$ kubectl get deployments.apps +deploykubectl get deployments.apps ``` ```bash -$ kubectl get deployments.v1.apps +deploykubectl get deployments.v1.apps ``` {% endmethod %} @@ -86,7 +86,7 @@ Get named Resources in a namespace for a given type. {% sample lang="yaml" %} ```bash -$ kubectl get deployment nginx +deploykubectl get deployment nginx ``` {% endmethod %} @@ -98,7 +98,7 @@ Get **all** Resources in a namespace **matching a label select** for a given typ {% sample lang="yaml" %} ```bash -$ kubectl get deployments -l app=nginx +deploykubectl get deployments -l app=nginx ``` {% endmethod %} @@ -114,7 +114,7 @@ The `---all-namespaces` flag will **fetch Resources from all namespaces**. {% sample lang="yaml" %} ```bash -$ kubectl get deployments --all-namespaces +deploykubectl get deployments --all-namespaces ``` {% endmethod %} @@ -128,7 +128,7 @@ Get and Describe can accept **multiple Resource types**, and it will print them {% sample lang="yaml" %} ```bash -$ kubectl get deployments,services +deploykubectl get deployments,services ``` {% endmethod %} @@ -142,7 +142,7 @@ Get and Describe can accept **multiple Resource types and names**. {% sample lang="yaml" %} ```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 %} @@ -156,7 +156,7 @@ These Resources can be view with the `--include-uninitialized` flag. {% sample lang="yaml" %} ```bash -$ kubectl get deployments --include-uninitialized +deploykubectl get deployments --include-uninitialized ``` {% endmethod %} @@ -170,7 +170,7 @@ The `--ignore-not-found` flag will cause kubectl to exit 0 if the Resource is no {% sample lang="yaml" %} ```bash -$ kubectl get deployment nginx --ignore-not-found +deploykubectl get deployment nginx --ignore-not-found ``` {% endmethod %} diff --git a/docs/book/pages/resource_printing/raw.md b/docs/book/pages/resource_printing/raw.md index 3ee488a7c..489567af2 100644 --- a/docs/book/pages/resource_printing/raw.md +++ b/docs/book/pages/resource_printing/raw.md @@ -32,7 +32,7 @@ Print the Raw Resource formatting it as YAML. {% sample lang="yaml" %} ```bash -$ kubectl get deployments -o yaml +deploykubectl get deployments -o yaml ``` ```yaml @@ -120,7 +120,7 @@ Print the Raw Resource formatting it as JSON. {% sample lang="yaml" %} ```bash -$ kubectl get deployments -o json +deploykubectl get deployments -o json ``` ```json diff --git a/docs/book/pages/resource_printing/summaries.md b/docs/book/pages/resource_printing/summaries.md index da8219ad6..64249c065 100644 --- a/docs/book/pages/resource_printing/summaries.md +++ b/docs/book/pages/resource_printing/summaries.md @@ -29,7 +29,7 @@ be a summary of fields. {% sample lang="yaml" %} ```bash -$ kubectl get deployments nginx +deploykubectl get deployments nginx ``` ```bash @@ -52,7 +52,7 @@ be a summary of fields. {% sample lang="yaml" %} ```bash -$ kubectl get -o=wide deployments nginx +deploykubectl get -o=wide deployments nginx ``` ```bash @@ -74,7 +74,7 @@ Print out specific fields as Columns. {% sample lang="yaml" %} ```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 @@ -112,7 +112,7 @@ Print out all labels on each Resource in a single column (last). {% sample lang="yaml" %} ```bash -$ kubectl get deployment --show-labels +deploykubectl get deployment --show-labels ``` ```bash @@ -135,7 +135,7 @@ they want to know which API is being used. {% sample lang="yaml" %} ```bash -$ kubectl get deployments --show-kind +deploykubectl get deployments --show-kind ``` ```bash