Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting example to avoid ambiguity #14354

Merged
merged 1 commit into from
May 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,38 +90,38 @@ for database debugging.

## Forward a local port to a port on the pod

1. `kubectl port-forward` allows using resource name, such as a service name, to select a matching pod to port forward to since Kubernetes v1.10.
1. `kubectl port-forward` allows using resource name, such as a pod name, to select a matching pod to port forward to since Kubernetes v1.10.

kubectl port-forward redis-master-765d459796-258hz 6379:6379
kubectl port-forward redis-master-765d459796-258hz 7000:6379

which is the same as

kubectl port-forward pods/redis-master-765d459796-258hz 6379:6379
kubectl port-forward pods/redis-master-765d459796-258hz 7000:6379

or

kubectl port-forward deployment/redis-master 6379:6379
kubectl port-forward deployment/redis-master 7000:6379

or

kubectl port-forward rs/redis-master 6379:6379
kubectl port-forward rs/redis-master 7000:6379

or

kubectl port-forward svc/redis-master 6379:6379
kubectl port-forward svc/redis-master 7000:6379

Any of the above commands works. The output is similar to this:

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
I0710 14:43:38.274550 3655 portforward.go:225] Forwarding from 127.0.0.1:7000 -> 6379
I0710 14:43:38.274797 3655 portforward.go:225] Forwarding from [::1]:7000 -> 6379

2. Start the Redis command line interface:

redis-cli

3. At the Redis command line prompt, enter the `ping` command:

127.0.0.1:6379>ping
127.0.0.1:7000>ping

A successful ping request returns PONG.

Expand All @@ -132,7 +132,7 @@ for database debugging.

## Discussion

Connections made to local port 6379 are forwarded to port 6379 of the pod that
Connections made to local port 7000 are forwarded to port 6379 of the pod that
is running the Redis server. With this connection in place you can use your
local workstation to debug the database that is running in the pod.

Expand Down