diff --git a/docs/user-guide/connecting-to-applications-port-forward.md b/docs/user-guide/connecting-to-applications-port-forward.md index 5d74ee3068e..a4c19f659ab 100644 --- a/docs/user-guide/connecting-to-applications-port-forward.md +++ b/docs/user-guide/connecting-to-applications-port-forward.md @@ -37,14 +37,14 @@ kubectl port-forward forwards connections to a local port to a port on a pod. It ## Creating a Redis master -``` -$kubectl create examples/redis/redis-master.yaml +```console +$ kubectl create examples/redis/redis-master.yaml pods/redis-master ``` wait until the Redis master pod is Running and Ready, -``` +```console $ kubectl get pods NAME READY STATUS RESTARTS AGE redis-master 2/2 Running 0 41s @@ -55,7 +55,7 @@ redis-master 2/2 Running 0 41s The Redis master is listening on port 6397, to verify this, -``` +```console $ kubectl get pods redis-master -t='{{(index (index .spec.containers 0).ports 0).containerPort}}{{"\n"}}' 6379 ``` @@ -63,7 +63,7 @@ $ kubectl get pods redis-master -t='{{(index (index .spec.containers 0).ports 0) then we forward the port 6379 on the local workstation to the port 6379 of pod redis-master, -``` +```console $ kubectl port-forward -p redis-master 6379:6379 I0710 14:43:38.274550 3655 portforward.go:225] Forwarding from 127.0.0.1:6379 -> 6379 I0710 14:43:38.274797 3655 portforward.go:225] Forwarding from [::1]:6379 -> 6379 @@ -71,7 +71,7 @@ I0710 14:43:38.274797 3655 portforward.go:225] Forwarding from [::1]:6379 -> To verify the connection is successful, we run a redis-cli on the local workstation, -``` +```console $ redis-cli 127.0.0.1:6379> ping PONG