From 498277aaec1fa68789099f791a06c668b760f113 Mon Sep 17 00:00:00 2001 From: redsoxfantom Date: Mon, 29 Jan 2024 13:26:26 -0500 Subject: [PATCH] Final updates --- docs/12-dns-addon.md | 2 +- docs/13-smoke-test.md | 32 ++++++++++++++++++++++++++++++++ docs/14-cleanup.md | 12 ++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/docs/12-dns-addon.md b/docs/12-dns-addon.md index be81ef6..cf8e817 100644 --- a/docs/12-dns-addon.md +++ b/docs/12-dns-addon.md @@ -7,7 +7,7 @@ In this lab you will deploy the [DNS add-on](https://kubernetes.io/docs/concepts Deploy the `coredns` cluster add-on: ``` -kubectl apply -f https://storage.googleapis.com/kubernetes-the-hard-way/coredns-1.8.yaml +kubectl apply -f deployments/coredns-1.7.0.yaml ``` > output diff --git a/docs/13-smoke-test.md b/docs/13-smoke-test.md index 566ace7..3b5b824 100644 --- a/docs/13-smoke-test.md +++ b/docs/13-smoke-test.md @@ -15,6 +15,7 @@ kubectl create secret generic kubernetes-the-hard-way \ Print a hexdump of the `kubernetes-the-hard-way` secret stored in etcd: +```gcloud``` ``` gcloud compute ssh controller-0 \ --command "sudo ETCDCTL_API=3 etcdctl get \ @@ -25,6 +26,17 @@ gcloud compute ssh controller-0 \ /registry/secrets/default/kubernetes-the-hard-way | hexdump -C" ``` +```az``` +``` +ssh -i $HOME/.ssh/k8sthehardway azureuser@$(az vm show -d --name controller-0 --query "publicIps" -o tsv) \ + "sudo ETCDCTL_API=3 etcdctl get \ + --endpoints=https://127.0.0.1:2379 \ + --cacert=/etc/etcd/ca.pem \ + --cert=/etc/etcd/kubernetes.pem \ + --key=/etc/etcd/kubernetes-key.pem\ + /registry/secrets/default/kubernetes-the-hard-way | hexdump -C" +``` + > output ``` @@ -184,19 +196,39 @@ NODE_PORT=$(kubectl get svc nginx \ Create a firewall rule that allows remote access to the `nginx` node port: +```gcloud``` ``` gcloud compute firewall-rules create kubernetes-the-hard-way-allow-nginx-service \ --allow=tcp:${NODE_PORT} \ --network kubernetes-the-hard-way ``` +```az``` +``` +az network nsg rule create \ + --name kubernetes-the-hard-way-inbound-smoke-test \ + --nsg-name kubernetes-the-hard-way-nsg \ + --priority 300 \ + --access ALLOW \ + --source-address-prefixes 0.0.0.0/0 \ + --destination-port-ranges ${NODE_PORT} \ + --protocol Tcp \ + --direction Inbound +``` + Retrieve the external IP address of a worker instance: +```gcloud``` ``` EXTERNAL_IP=$(gcloud compute instances describe worker-0 \ --format 'value(networkInterfaces[0].accessConfigs[0].natIP)') ``` +```az``` +``` +EXTERNAL_IP=$(az vm show -d -n worker-0 --query publicIps -o tsv) +``` + Make an HTTP request using the external IP address and the `nginx` node port: ``` diff --git a/docs/14-cleanup.md b/docs/14-cleanup.md index 5ab908c..8af8c5d 100644 --- a/docs/14-cleanup.md +++ b/docs/14-cleanup.md @@ -2,6 +2,7 @@ In this lab you will delete the compute resources created during this tutorial. +```gcloud``` ## Compute Instances Delete the controller and worker compute instances: @@ -61,3 +62,14 @@ Delete the `kubernetes-the-hard-way` compute address: gcloud -q compute addresses delete kubernetes-the-hard-way \ --region $(gcloud config get-value compute/region) ``` + +```az``` +## Resource Group + +Delete the `k8s-the-hard-way` resource group, all other resources will be deleted automatically: + +``` +az group delete --resource-group k8s-the-hard-way +``` + +This command takes a while, be patient... \ No newline at end of file