mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Improve console output in k8s201 walkthrough.
This commit is contained in:
parent
d95ca69400
commit
9b474c1afe
@ -86,13 +86,13 @@ spec:
|
|||||||
|
|
||||||
Create the labeled pod ([pod-nginx-with-label.yaml](pod-nginx-with-label.yaml)):
|
Create the labeled pod ([pod-nginx-with-label.yaml](pod-nginx-with-label.yaml)):
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ kubectl create -f docs/user-guide/walkthrough/pod-nginx-with-label.yaml
|
$ kubectl create -f docs/user-guide/walkthrough/pod-nginx-with-label.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
List all pods with the label `app=nginx`:
|
List all pods with the label `app=nginx`:
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ kubectl get pods -l app=nginx
|
$ kubectl get pods -l app=nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -139,19 +139,19 @@ spec:
|
|||||||
|
|
||||||
Create an nginx replication controller ([replication-controller.yaml](replication-controller.yaml)):
|
Create an nginx replication controller ([replication-controller.yaml](replication-controller.yaml)):
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ kubectl create -f docs/user-guide/walkthrough/replication-controller.yaml
|
$ kubectl create -f docs/user-guide/walkthrough/replication-controller.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
List all replication controllers:
|
List all replication controllers:
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ kubectl get rc
|
$ kubectl get rc
|
||||||
```
|
```
|
||||||
|
|
||||||
Delete the replication controller by name:
|
Delete the replication controller by name:
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ kubectl delete rc nginx-controller
|
$ kubectl delete rc nginx-controller
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -187,13 +187,13 @@ spec:
|
|||||||
|
|
||||||
Create an nginx service ([service.yaml](service.yaml)):
|
Create an nginx service ([service.yaml](service.yaml)):
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ kubectl create -f docs/user-guide/walkthrough/service.yaml
|
$ kubectl create -f docs/user-guide/walkthrough/service.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
List all services:
|
List all services:
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ kubectl get services
|
$ kubectl get services
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ On most providers, the service IPs are not externally accessible. The easiest wa
|
|||||||
|
|
||||||
Provided the service IP is accessible, you should be able to access its http endpoint with curl on port 80:
|
Provided the service IP is accessible, you should be able to access its http endpoint with curl on port 80:
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ export SERVICE_IP=$(kubectl get service nginx-service -o=template -t={{.spec.clusterIP}})
|
$ export SERVICE_IP=$(kubectl get service nginx-service -o=template -t={{.spec.clusterIP}})
|
||||||
$ export SERVICE_PORT=$(kubectl get service nginx-service -o=template '-t={{(index .spec.ports 0).port}}')
|
$ export SERVICE_PORT=$(kubectl get service nginx-service -o=template '-t={{(index .spec.ports 0).port}}')
|
||||||
$ curl http://${SERVICE_IP}:${SERVICE_PORT}
|
$ curl http://${SERVICE_IP}:${SERVICE_PORT}
|
||||||
@ -209,7 +209,7 @@ $ curl http://${SERVICE_IP}:${SERVICE_PORT}
|
|||||||
|
|
||||||
To delete the service by name:
|
To delete the service by name:
|
||||||
|
|
||||||
```sh
|
```console
|
||||||
$ kubectl delete service nginx-controller
|
$ kubectl delete service nginx-controller
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user