From 7ed632a08cde6e946d6212ab1056e4e232206467 Mon Sep 17 00:00:00 2001 From: Mumshad Date: Wed, 20 Mar 2019 18:12:49 +0800 Subject: [PATCH] Fix links Update Smoke Tests --- README.md | 4 +- docs/03-client-tools.md | 2 +- docs/09-bootstrapping-kubernetes-workers.md | 2 +- ...10-tls-bootstrapping-kubernetes-workers.md | 2 + docs/12-configure-pod-networking.md | 2 + ...let.md => 13-kube-apiserver-to-kubelet.md} | 2 + docs/{13-dns-addon.md => 14-dns-addon.md} | 2 +- docs/15-smoke-test.md | 238 +++--------------- 8 files changed, 40 insertions(+), 214 deletions(-) rename docs/{14-kube-apiserver-to-kubelet.md => 13-kube-apiserver-to-kubelet.md} (98%) rename docs/{13-dns-addon.md => 14-dns-addon.md} (97%) diff --git a/README.md b/README.md index df13b2d..8c335b6 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,8 @@ Kubernetes The Hard Way guides you through bootstrapping a highly available Kube * [TLS Bootstrapping the Kubernetes Worker Nodes](docs/10-tls-bootstrapping-kubernetes-workers.md) * [Configuring kubectl for Remote Access](docs/11-configuring-kubectl.md) * [Deploy Weave - Pod Networking Solution](docs/12-configure-pod-networking.md) -* [Deploying the DNS Cluster Add-on](docs/13-dns-addon.md) -* [Kube API Server to Kubelet Configuration](docs/14-kube-apiserver-to-kubelet.md) +* [Kube API Server to Kubelet Configuration](docs/13-kube-apiserver-to-kubelet.md) +* [Deploying the DNS Cluster Add-on](docs/14-dns-addon.md) * [Smoke Test](docs/15-smoke-test.md) * [E2E Test](docs/16-e2e-tests.md) * [Extra - Dynamic Kubelet Configuration](docs/17-extra-dynamic-kubelet-configuration.md) diff --git a/docs/03-client-tools.md b/docs/03-client-tools.md index d2ba54a..576e064 100644 --- a/docs/03-client-tools.md +++ b/docs/03-client-tools.md @@ -59,4 +59,4 @@ kubectl version --client Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.0", GitCommit:"ddf47ac13c1a9483ea035a79cd7c10005ff21a6d", GitTreeState:"clean", BuildDate:"2018-12-03T21:04:45Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"} ``` -Next: [Provisioning Compute Resources](03-compute-resources.md) +Next: [Certificate Authority](04-certificate-authority.md) diff --git a/docs/09-bootstrapping-kubernetes-workers.md b/docs/09-bootstrapping-kubernetes-workers.md index 2534db7..76c264c 100644 --- a/docs/09-bootstrapping-kubernetes-workers.md +++ b/docs/09-bootstrapping-kubernetes-workers.md @@ -255,4 +255,4 @@ worker-1 NotReady 93s v1.13.0 > Note: It is OK for the worker node to be in a NotReady state. That is because we haven't configured Networking yet. -Next: [Configuring kubectl for Remote Access](10-configuring-kubectl.md) +Next: [TLS Bootstrapping Kubernetes Workers](10-tls-bootstrapping-kubernetes-workers.md) diff --git a/docs/10-tls-bootstrapping-kubernetes-workers.md b/docs/10-tls-bootstrapping-kubernetes-workers.md index c6fd048..c9cc451 100644 --- a/docs/10-tls-bootstrapping-kubernetes-workers.md +++ b/docs/10-tls-bootstrapping-kubernetes-workers.md @@ -399,3 +399,5 @@ NAME STATUS ROLES AGE VERSION worker-1 Ready 12h v1.13.0 worker-2 Ready 37m v1.13.0 ``` + +Next: [Configuring Kubectl](11-configuring-kubectl.md) diff --git a/docs/12-configure-pod-networking.md b/docs/12-configure-pod-networking.md index fcc9efe..4c8b901 100644 --- a/docs/12-configure-pod-networking.md +++ b/docs/12-configure-pod-networking.md @@ -36,3 +36,5 @@ NAME READY STATUS RESTARTS AGE weave-net-58j2j 2/2 Running 0 89s weave-net-rr5dk 2/2 Running 0 89s ``` + +Next: [Kube API Server to Kubelet Connectivity](13-kube-apiserver-to-kubelet.md) diff --git a/docs/14-kube-apiserver-to-kubelet.md b/docs/13-kube-apiserver-to-kubelet.md similarity index 98% rename from docs/14-kube-apiserver-to-kubelet.md rename to docs/13-kube-apiserver-to-kubelet.md index 62395cf..80407bf 100644 --- a/docs/14-kube-apiserver-to-kubelet.md +++ b/docs/13-kube-apiserver-to-kubelet.md @@ -52,3 +52,5 @@ subjects: name: kube-apiserver EOF ``` + +Next: [DNS Addon](14-dns-addon.md) diff --git a/docs/13-dns-addon.md b/docs/14-dns-addon.md similarity index 97% rename from docs/13-dns-addon.md rename to docs/14-dns-addon.md index 9f90120..6f2776f 100644 --- a/docs/13-dns-addon.md +++ b/docs/14-dns-addon.md @@ -72,4 +72,4 @@ Name: kubernetes Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local ``` -Next: [Smoke Test](14-kube-apiserver-to-kubelet.md) +Next: [Smoke Test](15-smoke-test.md) diff --git a/docs/15-smoke-test.md b/docs/15-smoke-test.md index da1dbbe..5b63a27 100644 --- a/docs/15-smoke-test.md +++ b/docs/15-smoke-test.md @@ -57,13 +57,13 @@ In this section you will verify the ability to create and manage [Deployments](h Create a deployment for the [nginx](https://nginx.org/en/) web server: ``` -kubectl run nginx --image=nginx +kubectl create deployment nginx --image=nginx ``` List the pod created by the `nginx` deployment: ``` -kubectl get pods -l run=nginx +kubectl get pods -l app=nginx ``` > output @@ -73,62 +73,49 @@ NAME READY STATUS RESTARTS AGE nginx-dbddb74b8-6lxg2 1/1 Running 0 10s ``` -### Port Forwarding +### Services In this section you will verify the ability to access applications remotely using [port forwarding](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/). -Retrieve the full name of the `nginx` pod: +Create a service to expose deployment nginx on node ports. ``` -POD_NAME=$(kubectl get pods -l run=nginx -o jsonpath="{.items[0].metadata.name}") +kubectl expose deploy nginx --type=NodePort --port 80 ``` -Forward port `8080` on your local machine to port `80` of the `nginx` pod: ``` -kubectl port-forward $POD_NAME 8080:80 +PORT_NUMBER=$(kubectl get svc -l app=nginx -o jsonpath="{.items[0].spec.ports[0].nodePort}") +``` + +Test to view NGINX page + +``` +curl http://worker-1:$PORT_NUMBER +curl http://worker-2:$PORT_NUMBER ``` > output ``` -Forwarding from 127.0.0.1:8080 -> 80 -Forwarding from [::1]:8080 -> 80 -``` - -In a new terminal make an HTTP request using the forwarding address: - -``` -curl --head http://127.0.0.1:8080 -``` - -> output - -``` -HTTP/1.1 200 OK -Server: nginx/1.15.4 -Date: Sun, 30 Sep 2018 19:23:10 GMT -Content-Type: text/html -Content-Length: 612 -Last-Modified: Tue, 25 Sep 2018 15:04:03 GMT -Connection: keep-alive -ETag: "5baa4e63-264" -Accept-Ranges: bytes -``` - -Switch back to the previous terminal and stop the port forwarding to the `nginx` pod: - -``` -Forwarding from 127.0.0.1:8080 -> 80 -Forwarding from [::1]:8080 -> 80 -Handling connection for 8080 -^C + + + +Welcome to nginx! + # Output Truncated for brevity + ``` ### Logs In this section you will verify the ability to [retrieve container logs](https://kubernetes.io/docs/concepts/cluster-administration/logging/). +Retrieve the full name of the `nginx` pod: + +``` +POD_NAME=$(kubectl get pods -l app=nginx -o jsonpath="{.items[0].metadata.name}") +``` + Print the `nginx` pod logs: ``` @@ -138,7 +125,8 @@ kubectl logs $POD_NAME > output ``` -127.0.0.1 - - [30/Sep/2018:19:23:10 +0000] "HEAD / HTTP/1.1" 200 0 "-" "curl/7.58.0" "-" +10.32.0.1 - - [20/Mar/2019:10:08:30 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.58.0" "-" +10.40.0.0 - - [20/Mar/2019:10:08:55 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.58.0" "-" ``` ### Exec @@ -154,175 +142,7 @@ kubectl exec -ti $POD_NAME -- nginx -v > output ``` -nginx version: nginx/1.15.4 +nginx version: nginx/1.15.9 ``` -## Services - -In this section you will verify the ability to expose applications using a [Service](https://kubernetes.io/docs/concepts/services-networking/service/). - -Expose the `nginx` deployment using a [NodePort](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport) service: - -``` -kubectl expose deployment nginx --port 80 --type NodePort -``` - -> The LoadBalancer service type can not be used because your cluster is not configured with [cloud provider integration](https://kubernetes.io/docs/getting-started-guides/scratch/#cloud-provider). Setting up cloud provider integration is out of scope for this tutorial. - -Retrieve the node port assigned to the `nginx` service: - -``` -NODE_PORT=$(kubectl get svc nginx \ - --output=jsonpath='{range .spec.ports[0]}{.nodePort}') -``` - -Create a firewall rule that allows remote access to the `nginx` node port: - -``` -gcloud compute firewall-rules create kubernetes-the-hard-way-allow-nginx-service \ - --allow=tcp:${NODE_PORT} \ - --network kubernetes-the-hard-way -``` - -Retrieve the external IP address of a worker instance: - -``` -EXTERNAL_IP=$(gcloud compute instances describe worker-0 \ - --format 'value(networkInterfaces[0].accessConfigs[0].natIP)') -``` - -Make an HTTP request using the external IP address and the `nginx` node port: - -``` -curl -I http://${EXTERNAL_IP}:${NODE_PORT} -``` - -> output - -``` -HTTP/1.1 200 OK -Server: nginx/1.15.4 -Date: Sun, 30 Sep 2018 19:25:40 GMT -Content-Type: text/html -Content-Length: 612 -Last-Modified: Tue, 25 Sep 2018 15:04:03 GMT -Connection: keep-alive -ETag: "5baa4e63-264" -Accept-Ranges: bytes -``` - -## Untrusted Workloads - -This section will verify the ability to run untrusted workloads using [gVisor](https://github.com/google/gvisor). - -Create the `untrusted` pod: - -``` -cat < output - -``` -I0930 19:31:31.419765 21217 x:0] *************************** -I0930 19:31:31.419907 21217 x:0] Args: [runsc --root /run/containerd/runsc/k8s.io ps af7470029008a4520b5db9fb5b358c65d64c9f748fae050afb6eaf014a59fea5] -I0930 19:31:31.419959 21217 x:0] Git Revision: 50c283b9f56bb7200938d9e207355f05f79f0d17 -I0930 19:31:31.420000 21217 x:0] PID: 21217 -I0930 19:31:31.420041 21217 x:0] UID: 0, GID: 0 -I0930 19:31:31.420081 21217 x:0] Configuration: -I0930 19:31:31.420115 21217 x:0] RootDir: /run/containerd/runsc/k8s.io -I0930 19:31:31.420188 21217 x:0] Platform: ptrace -I0930 19:31:31.420266 21217 x:0] FileAccess: exclusive, overlay: false -I0930 19:31:31.420424 21217 x:0] Network: sandbox, logging: false -I0930 19:31:31.420515 21217 x:0] Strace: false, max size: 1024, syscalls: [] -I0930 19:31:31.420676 21217 x:0] *************************** -UID PID PPID C STIME TIME CMD -0 1 0 0 19:26 10ms app -I0930 19:31:31.422022 21217 x:0] Exiting with status: 0 -``` - -Next: [Cleaning Up](14-cleanup.md) +Next: [End to End Tests](16-e2e-test.md)