Skip to content

Commit

Permalink
Add code format
Browse files Browse the repository at this point in the history
  • Loading branch information
angao committed Jun 13, 2018
1 parent cb6af2a commit 88d05d7
Showing 1 changed file with 39 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,51 +37,69 @@ restarts. Here is the configuration file for the Pod:

1. Create the Pod:

kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/pod-redis.yaml
```shell
kubectl create -f https://k8s.io/docs/tasks/configure-pod-container/pod-redis.yaml
```

1. Verify that the Pod's Container is running, and then watch for changes to
the Pod:

kubectl get pod redis --watch

```shell
kubectl get pod redis --watch
```

The output looks like this:

NAME READY STATUS RESTARTS AGE
redis 1/1 Running 0 13s
```shell
NAME READY STATUS RESTARTS AGE
redis 1/1 Running 0 13s
```

1. In another terminal, get a shell to the running Container:

kubectl exec -it redis -- /bin/bash
```shell
kubectl exec -it redis -- /bin/bash
```

1. In your shell, go to `/data/redis`, and create a file:

root@redis:/data# cd /data/redis/
root@redis:/data/redis# echo Hello > test-file
```shell
root@redis:/data# cd /data/redis/
root@redis:/data/redis# echo Hello > test-file
```

1. In your shell, list the running processes:

root@redis:/data/redis# ps aux
```shell
root@redis:/data/redis# ps aux
```

The output is similar to this:

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
redis 1 0.1 0.1 33308 3828 ? Ssl 00:46 0:00 redis-server *:6379
root 12 0.0 0.0 20228 3020 ? Ss 00:47 0:00 /bin/bash
root 15 0.0 0.0 17500 2072 ? R+ 00:48 0:00 ps aux
```shell
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
redis 1 0.1 0.1 33308 3828 ? Ssl 00:46 0:00 redis-server *:6379
root 12 0.0 0.0 20228 3020 ? Ss 00:47 0:00 /bin/bash
root 15 0.0 0.0 17500 2072 ? R+ 00:48 0:00 ps aux
```

1. In your shell, kill the redis process:

root@redis:/data/redis# kill <pid>
```shell
root@redis:/data/redis# kill <pid>
```

where `<pid>` is the redis process ID (PID).

1. In your original terminal, watch for changes to the redis Pod. Eventually,
you will see something like this:

NAME READY STATUS RESTARTS AGE
redis 1/1 Running 0 13s
redis 0/1 Completed 0 6m
redis 1/1 Running 1 6m
```shell
NAME READY STATUS RESTARTS AGE
redis 1/1 Running 0 13s
redis 0/1 Completed 0 6m
redis 1/1 Running 1 6m
```

At this point, the Container has terminated and restarted. This is because the
redis Pod has a
Expand All @@ -90,7 +108,9 @@ of `Always`.

1. Get a shell into the restarted Container:

kubectl exec -it redis -- /bin/bash
```shell
kubectl exec -it redis -- /bin/bash
```

1. In your shell, goto `/data/redis`, and verify that `test-file` is still there.

Expand Down

0 comments on commit 88d05d7

Please sign in to comment.