Skip to content
Permalink
Browse files

Improvements for markdown formatting (#12193)

* Fixed markdown formatting

* Resolved usage of 'shell' instead of 'yaml'

* Removed unknown 'log' keyword
  • Loading branch information...
rlenferink authored and k8s-ci-robot committed Jan 14, 2019
1 parent 10a75e3 commit 1bc0d7c385822ea0a63e828b6b6913d64784afec
@@ -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.
@@ -46,37 +46,47 @@ 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.

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

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

@@ -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
@@ -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: <none>
Annotations: <none>

Type: Opaque
```
Name: test-secret
Namespace: default
Labels: <none>
Annotations: <none>
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
@@ -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
```

@@ -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
```

0 comments on commit 1bc0d7c

Please sign in to comment.
You can’t perform that action at this time.