mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-04 10:47:25 +00:00
Update tutorial about kubectl expose
This commit is contained in:
@@ -63,17 +63,22 @@ now run `docker ps` you should see nginx running. You may need to wait a few mi
|
||||
kubectl expose rc nginx --port=80
|
||||
```
|
||||
|
||||
This should print:
|
||||
|
||||
```console
|
||||
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
|
||||
nginx 10.179.240.1 <none> 80/TCP run=nginx 8d
|
||||
```
|
||||
|
||||
Hit the webserver:
|
||||
Run the following command to obtain the IP of this service we just created. There are two IPs, the first one is internal (CLUSTER_IP), and the second one is the external load-balanced IP.
|
||||
|
||||
```sh
|
||||
curl <insert-ip-from-above-here>
|
||||
kubectl get svc nginx
|
||||
```
|
||||
|
||||
Alternatively, you can obtain only the first IP (CLUSTER_IP) by running:
|
||||
|
||||
```sh
|
||||
kubectl get svc nginx --template={{.spec.clusterIP}}
|
||||
```
|
||||
|
||||
Hit the webserver with the first IP (CLUSTER_IP):
|
||||
|
||||
```sh
|
||||
curl <insert-cluster-ip-here>
|
||||
```
|
||||
|
||||
Note that you will need run this curl command on your boot2docker VM if you are running on OS X.
|
||||
|
@@ -178,23 +178,22 @@ Now run `docker ps` you should see nginx running. You may need to wait a few mi
|
||||
kubectl expose rc nginx --port=80
|
||||
```
|
||||
|
||||
This should print:
|
||||
|
||||
```console
|
||||
NAME LABELS SELECTOR IP(S) PORT(S)
|
||||
nginx run=nginx run=nginx 80/TCP
|
||||
```
|
||||
|
||||
If `IP(S)` is blank run the following command to obtain it. Know issue [#10836](https://github.com/kubernetes/kubernetes/issues/10836)
|
||||
Run the following command to obtain the IP of this service we just created. There are two IPs, the first one is internal (CLUSTER_IP), and the second one is the external load-balanced IP.
|
||||
|
||||
```sh
|
||||
kubectl get svc nginx
|
||||
```
|
||||
|
||||
Hit the webserver:
|
||||
Alternatively, you can obtain only the first IP (CLUSTER_IP) by running:
|
||||
|
||||
```sh
|
||||
curl <insert-ip-from-above-here>
|
||||
kubectl get svc nginx --template={{.spec.clusterIP}}
|
||||
```
|
||||
|
||||
Hit the webserver with the first IP (CLUSTER_IP):
|
||||
|
||||
```sh
|
||||
curl <insert-cluster-ip-here>
|
||||
```
|
||||
|
||||
Note that you will need run this curl command on your boot2docker VM if you are running on OS X.
|
||||
|
Reference in New Issue
Block a user