mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Fix output formatting for Getting Into Containers doc
This commit is contained in:
parent
715f2c488f
commit
ece25d03a7
@ -40,14 +40,14 @@ Kubernetes exposes [services](services.md#environment-variables) through environ
|
||||
|
||||
We first create a pod and a service,
|
||||
|
||||
```
|
||||
```console
|
||||
$ kubectl create -f examples/guestbook/redis-master-controller.yaml
|
||||
$ kubectl create -f examples/guestbook/redis-master-service.yaml
|
||||
```
|
||||
|
||||
wait until the pod is Running and Ready,
|
||||
|
||||
```
|
||||
```console
|
||||
$ kubectl get pod
|
||||
NAME READY REASON RESTARTS AGE
|
||||
redis-master-ft9ex 1/1 Running 0 12s
|
||||
@ -55,7 +55,7 @@ redis-master-ft9ex 1/1 Running 0 12s
|
||||
|
||||
then we can check the environment variables of the pod,
|
||||
|
||||
```
|
||||
```console
|
||||
$ kubectl exec redis-master-ft9ex env
|
||||
...
|
||||
REDIS_MASTER_SERVICE_PORT=6379
|
||||
@ -71,13 +71,13 @@ We can use these environment variables in applications to find the service.
|
||||
It is convenient to use `kubectl exec` to check if the volumes are mounted as expected.
|
||||
We first create a Pod with a volume mounted at /data/redis,
|
||||
|
||||
```
|
||||
```console
|
||||
kubectl create -f docs/user-guide/walkthrough/pod-redis.yaml
|
||||
```
|
||||
|
||||
wait until the pod is Running and Ready,
|
||||
|
||||
```
|
||||
```console
|
||||
$ kubectl get pods
|
||||
NAME READY REASON RESTARTS AGE
|
||||
storage 1/1 Running 0 1m
|
||||
@ -85,7 +85,7 @@ storage 1/1 Running 0 1m
|
||||
|
||||
we then use `kubectl exec` to verify that the volume is mounted at /data/redis,
|
||||
|
||||
```
|
||||
```console
|
||||
$ kubectl exec storage ls /data
|
||||
redis
|
||||
```
|
||||
@ -94,7 +94,7 @@ redis
|
||||
|
||||
After all, open a terminal in a pod is the most direct way to introspect the pod. Assuming the pod/storage is still running, run
|
||||
|
||||
```
|
||||
```console
|
||||
$ kubectl exec -ti storage -- bash
|
||||
root@storage:/data#
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user