From 1bc0d7c385822ea0a63e828b6b6913d64784afec Mon Sep 17 00:00:00 2001 From: Roy Lenferink Date: Mon, 14 Jan 2019 03:14:44 +0100 Subject: [PATCH] Improvements for markdown formatting (#12193) * Fixed markdown formatting * Resolved usage of 'shell' instead of 'yaml' * Removed unknown 'log' keyword --- .../access-cluster.md | 4 +- .../define-command-argument-container.md | 36 ++++++++++------ .../define-environment-variable-container.md | 4 +- .../distribute-credentials-secure.md | 42 +++++++++++-------- ...nward-api-volume-expose-pod-information.md | 4 +- ...ronment-variable-expose-pod-information.md | 12 +++--- 6 files changed, 61 insertions(+), 41 deletions(-) diff --git a/content/en/docs/tasks/access-application-cluster/access-cluster.md b/content/en/docs/tasks/access-application-cluster/access-cluster.md index 1fcd18c10c2f5..a6570563d91ef 100644 --- a/content/en/docs/tasks/access-application-cluster/access-cluster.md +++ b/content/en/docs/tasks/access-application-cluster/access-cluster.md @@ -160,11 +160,11 @@ at `/var/run/secrets/kubernetes.io/serviceaccount/namespace` in each container. From within a pod the recommended ways to connect to API are: - - run `kubectl proxy` in a sidecar container in the pod, or as a background + - Run `kubectl proxy` in a sidecar container in the pod, or as a background process within the container. This proxies the Kubernetes API to the localhost interface of the pod, so that other processes in any container of the pod can access it. - - use the Go client library, and create a client using the `rest.InClusterConfig()` and `kubernetes.NewForConfig()` functions. + - Use the Go client library, and create a client using the `rest.InClusterConfig()` and `kubernetes.NewForConfig()` functions. They handle locating and authenticating to the apiserver. [example](https://git.k8s.io/client-go/examples/in-cluster-client-configuration/main.go) In each case, the credentials of the pod are used to communicate securely with the apiserver. diff --git a/content/en/docs/tasks/inject-data-application/define-command-argument-container.md b/content/en/docs/tasks/inject-data-application/define-command-argument-container.md index 64fc918206e54..f7f2e2035fb40 100644 --- a/content/en/docs/tasks/inject-data-application/define-command-argument-container.md +++ b/content/en/docs/tasks/inject-data-application/define-command-argument-container.md @@ -46,11 +46,15 @@ file for the Pod defines a command and two arguments: 1. Create a Pod based on the YAML configuration file: - kubectl create -f https://k8s.io/examples/pods/commands.yaml + ```shell + kubectl create -f https://k8s.io/examples/pods/commands.yaml + ``` 1. List the running Pods: - kubectl get pods + ```shell + kubectl get pods + ``` The output shows that the container that ran in the command-demo Pod has completed. @@ -58,13 +62,17 @@ file for the Pod defines a command and two arguments: 1. To see the output of the command that ran in the container, view the logs from the Pod: - kubectl logs command-demo + ```shell + kubectl logs command-demo + ``` The output shows the values of the HOSTNAME and KUBERNETES_PORT environment variables: - command-demo - tcp://10.3.240.1:443 + ``` + command-demo + tcp://10.3.240.1:443 + ``` ## Use environment variables to define arguments @@ -72,11 +80,13 @@ In the preceding example, you defined the arguments directly by providing strings. As an alternative to providing strings directly, you can define arguments by using environment variables: - env: - - name: MESSAGE - value: "hello world" - command: ["/bin/echo"] - args: ["$(MESSAGE)"] +```yaml +env: +- name: MESSAGE + value: "hello world" +command: ["/bin/echo"] +args: ["$(MESSAGE)"] +``` This means you can define an argument for a Pod using any of the techniques available for defining environment variables, including @@ -95,8 +105,10 @@ In some cases, you need your command to run in a shell. For example, your command might consist of several commands piped together, or it might be a shell script. To run your command in a shell, wrap it like this: - command: ["/bin/sh"] - args: ["-c", "while true; do echo hello; sleep 10;done"] +```shell +command: ["/bin/sh"] +args: ["-c", "while true; do echo hello; sleep 10;done"] +``` ## Notes diff --git a/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md b/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md index f43c4cdc22f40..ec70cae998771 100644 --- a/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md +++ b/content/en/docs/tasks/inject-data-application/define-environment-variable-container.md @@ -48,7 +48,7 @@ Pod: The output is similar to this: - ```log + ``` NAME READY STATUS RESTARTS AGE envar-demo 1/1 Running 0 9s ``` @@ -67,7 +67,7 @@ Pod: The output is similar to this: - ```log + ``` NODE_VERSION=4.4.2 EXAMPLE_SERVICE_PORT_8080_TCP_ADDR=10.3.245.237 HOSTNAME=envar-demo diff --git a/content/en/docs/tasks/inject-data-application/distribute-credentials-secure.md b/content/en/docs/tasks/inject-data-application/distribute-credentials-secure.md index 9bb5175d2c4cf..a2533ac9c0d77 100644 --- a/content/en/docs/tasks/inject-data-application/distribute-credentials-secure.md +++ b/content/en/docs/tasks/inject-data-application/distribute-credentials-secure.md @@ -24,8 +24,10 @@ Suppose you want to have two pieces of secret data: a username `my-app` and a pa convert your username and password to a base-64 representation. Here's a Linux example: - echo -n 'my-app' | base64 - echo -n '39528$vdg7Jb' | base64 +```shell +echo -n 'my-app' | base64 +echo -n '39528$vdg7Jb' | base64 +``` The output shows that the base-64 representation of your username is `bXktYXBw`, and the base-64 representation of your password is `Mzk1MjgkdmRnN0pi`. @@ -45,32 +47,38 @@ username and password: 1. View information about the Secret: - kubectl get secret test-secret + ```shell + kubectl get secret test-secret + ``` Output: - NAME TYPE DATA AGE - test-secret Opaque 2 1m - + ``` + NAME TYPE DATA AGE + test-secret Opaque 2 1m + ``` 1. View more detailed information about the Secret: - kubectl describe secret test-secret + ```shell + kubectl describe secret test-secret + ``` Output: - Name: test-secret - Namespace: default - Labels: - Annotations: - - Type: Opaque + ``` + Name: test-secret + Namespace: default + Labels: + Annotations: - Data - ==== - password: 13 bytes - username: 7 bytes + Type: Opaque + Data + ==== + password: 13 bytes + username: 7 bytes + ``` {{< note >}} If you want to skip the Base64 encoding step, you can create a Secret diff --git a/content/en/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information.md b/content/en/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information.md index 643237887f4f0..d9bcccdd9e04c 100644 --- a/content/en/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information.md +++ b/content/en/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information.md @@ -84,7 +84,7 @@ builder="john-doe" Get a shell into the Container that is running in your Pod: -``` +```shell kubectl exec -it kubernetes-downwardapi-volume-example -- sh ``` @@ -177,7 +177,7 @@ kubectl create -f https://k8s.io/examples/pods/inject/dapi-volume-resources.yaml Get a shell into the Container that is running in your Pod: -``` +```shell kubectl exec -it kubernetes-downwardapi-volume-example-2 -- sh ``` diff --git a/content/en/docs/tasks/inject-data-application/environment-variable-expose-pod-information.md b/content/en/docs/tasks/inject-data-application/environment-variable-expose-pod-information.md index 2c543b1d6fd3f..ddb32c380a34e 100644 --- a/content/en/docs/tasks/inject-data-application/environment-variable-expose-pod-information.md +++ b/content/en/docs/tasks/inject-data-application/environment-variable-expose-pod-information.md @@ -60,13 +60,13 @@ kubectl create -f https://k8s.io/examples/pods/inject/dapi-envars-pod.yaml Verify that the Container in the Pod is running: -``` +```shell kubectl get pods ``` View the Container's logs: -``` +```shell kubectl logs dapi-envars-fieldref ``` @@ -86,13 +86,13 @@ five environment variables to stdout. It repeats this every ten seconds. Next, get a shell into the Container that is running in your Pod: -``` +```shell kubectl exec -it dapi-envars-fieldref -- sh ``` In your shell, view the environment variables: -``` +```shell /# printenv ``` @@ -135,13 +135,13 @@ kubectl create -f https://k8s.io/examples/pods/inject/dapi-envars-container.yaml Verify that the Container in the Pod is running: -``` +```shell kubectl get pods ``` View the Container's logs: -``` +```shell kubectl logs dapi-envars-resourcefieldref ```