From bcd6bc40af2aaa0aa74630409829fea61da3c630 Mon Sep 17 00:00:00 2001 From: Paul Rogers Date: Sun, 18 Mar 2018 14:17:01 -0700 Subject: [PATCH 1/2] Update k8s201.md Change instructions to download yams files directly from the website (as used in other pages.) Added instructions to delete labeled pod to avoid warnings in the subsequent deployment step. --- docs/user-guide/walkthrough/k8s201.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/user-guide/walkthrough/k8s201.md b/docs/user-guide/walkthrough/k8s201.md index 8bf5f9a2dc881..825567f38951d 100644 --- a/docs/user-guide/walkthrough/k8s201.md +++ b/docs/user-guide/walkthrough/k8s201.md @@ -37,7 +37,7 @@ For example, here is the nginx Pod definition with labels ([pod-nginx-with-label Create the labeled Pod ([pod-nginx-with-label.yaml](/docs/user-guide/walkthrough/pod-nginx-with-label.yaml)): ```shell -kubectl create -f docs/user-guide/walkthrough/pod-nginx-with-label.yaml +kubectl create -f https://k8s.io/docs/user-guide/walkthrough/pod-nginx-with-label.yaml ``` List all Pods with the label `app=nginx`: @@ -46,6 +46,12 @@ List all Pods with the label `app=nginx`: kubectl get pods -l app=nginx ``` +Delete the Pod by label: + +```shell +kubectl delete pod -l app=nginx +``` + For more information, see [Labels](/docs/concepts/overview/working-with-objects/labels/). They are a core concept used by two additional Kubernetes building blocks: Deployments and Services. @@ -67,10 +73,8 @@ Here is a Deployment that instantiates two nginx Pods: Create an nginx Deployment: -Download the `deployment.yaml` above by clicking on the file name and copy to your local directory. - ```shell -kubectl create -f ./deployment.yaml +kubectl create -f https://k8s.io/docs/user-guide/walkthrough/deployment.yaml ``` List all Deployments: @@ -90,10 +94,8 @@ contains the desired changes: {% include code.html language="yaml" file="deployment-update.yaml" ghlink="/docs/user-guide/walkthrough/deployment-update.yaml" %} -Download ./deployment-update.yaml and copy to your local directory. - ```shell -kubectl apply -f ./deployment-update.yaml +kubectl apply -f https://k8s.io/docs/user-guide/walkthrough//deployment-update.yaml ``` Watch the Deployment create Pods with new names and delete the old Pods: @@ -125,7 +127,7 @@ For example, here is a service that balances across the Pods created in the prev Create an nginx service ([service.yaml](/docs/user-guide/walkthrough/service.yaml)): ```shell -kubectl create -f docs/user-guide/walkthrough/service.yaml +kubectl create -f https://k8s.io/docs/user-guide/walkthrough/service.yaml ``` List all services: From 16a7c5dbadcb33d73bbcd22aa337c4331e2dad5f Mon Sep 17 00:00:00 2001 From: Paul Rogers Date: Sun, 18 Mar 2018 14:53:09 -0700 Subject: [PATCH 2/2] Update k8s201.md Added example of using the exposed host from the a node running Kubernetes. (This works on AWS with Weave; not able to test it on other variations...) --- docs/user-guide/walkthrough/k8s201.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/user-guide/walkthrough/k8s201.md b/docs/user-guide/walkthrough/k8s201.md index 825567f38951d..8774b718f442b 100644 --- a/docs/user-guide/walkthrough/k8s201.md +++ b/docs/user-guide/walkthrough/k8s201.md @@ -152,6 +152,14 @@ $ kubectl delete pod busybox # Clean up the pod we created with "kubectl run" {% endraw %} ``` +The service definition [exposed the Nginx Service](/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/) as port 8000 (`$SERVCE_PORT`). We can also access the service from a host running Kubernetes using that port: + +```shell +wget -qO- http://$SERVICE_IP:$SERVICE_PORT # Run on a Kubernetes host +``` + +(This works on AWS with Weave.) + To delete the service by name: ```shell