From 8938dfb8c6f3ad1ed4e0420064c59061a4748c87 Mon Sep 17 00:00:00 2001 From: Tom English Date: Sun, 17 Dec 2023 12:36:12 -0500 Subject: [PATCH] Work on creating compute resources --- docs/01-prerequisites.md | 2 ++ docs/03-compute-resources.md | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/01-prerequisites.md b/docs/01-prerequisites.md index bab614f..78026bd 100644 --- a/docs/01-prerequisites.md +++ b/docs/01-prerequisites.md @@ -1,5 +1,7 @@ # Prerequisites +This tutorial can be followed using either Google Cloud Platform or Microsoft Azure. Any sections where the commands to be entered are different based on the selected platform will either be captioned ```gcloud``` or ```az```, depending on the platform that the command applies to. + ## Google Cloud Platform This tutorial leverages the [Google Cloud Platform](https://cloud.google.com/) to streamline provisioning of the compute infrastructure required to bootstrap a Kubernetes cluster from the ground up. [Sign up](https://cloud.google.com/free/) for $300 in free credits. diff --git a/docs/03-compute-resources.md b/docs/03-compute-resources.md index a5402bb..23d0c58 100644 --- a/docs/03-compute-resources.md +++ b/docs/03-compute-resources.md @@ -4,6 +4,8 @@ Kubernetes requires a set of machines to host the Kubernetes control plane and t > Ensure a default compute zone and region have been set as described in the [Prerequisites](01-prerequisites.md#set-a-default-compute-region-and-zone) lab. +> If you are using Azure, ensure that the azure cli has been set up and configured as described in the [Prerequisites](01-prerequisites.md#az-setup) lab. + ## Networking The Kubernetes [networking model](https://kubernetes.io/docs/concepts/cluster-administration/networking/#kubernetes-model) assumes a flat network in which containers and nodes can communicate with each other. In cases where this is not desired [network policies](https://kubernetes.io/docs/concepts/services-networking/network-policies/) can limit how groups of containers are allowed to communicate with each other and external network endpoints. @@ -12,24 +14,43 @@ The Kubernetes [networking model](https://kubernetes.io/docs/concepts/cluster-ad ### Virtual Private Cloud Network -In this section a dedicated [Virtual Private Cloud](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) (VPC) network will be setup to host the Kubernetes cluster. +In this section a dedicated Virtual Private Cloud (VPC) network will be setup to host the Kubernetes cluster. + +[Azure VPC documentation](https://learn.microsoft.com/en-us/azure/virtual-network/) + +[GCloud VPC documentation](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) Create the `kubernetes-the-hard-way` custom VPC network: +```gcloud``` ``` gcloud compute networks create kubernetes-the-hard-way --subnet-mode custom ``` +```az``` +``` +az network vnet create --name kubernetes-the-hard-way --address-prefix 10.240.0.0/24 +``` -A [subnet](https://cloud.google.com/compute/docs/vpc/#vpc_networks_and_subnets) must be provisioned with an IP address range large enough to assign a private IP address to each node in the Kubernetes cluster. +A subnet must be provisioned with an IP address range large enough to assign a private IP address to each node in the Kubernetes cluster. + +[Azure Subnet documentation](https://learn.microsoft.com/en-us/azure/virtual-network/network-overview#virtual-network-and-subnets) + +[GCloud Subnet documentation](https://cloud.google.com/compute/docs/vpc/#vpc_networks_and_subnets) Create the `kubernetes` subnet in the `kubernetes-the-hard-way` VPC network: +```gcloud``` ``` gcloud compute networks subnets create kubernetes \ --network kubernetes-the-hard-way \ --range 10.240.0.0/24 ``` +```az``` +``` +az network vnet subnet create --name kubernetes --vnet-name kubernetes-the-hard-way --address-prefixes 10.240.0.0/24 +``` + > The `10.240.0.0/24` IP address range can host up to 254 compute instances. ### Firewall Rules