From 31d0b4b8940762e43d77bd93c41e004cacc26cfc Mon Sep 17 00:00:00 2001 From: Tu Nguyen Date: Mon, 11 Jan 2021 23:34:19 -0800 Subject: [PATCH] consolidated instructions --- README.md | 99 +----------------------------------------------- terraform.tfvars | 2 +- 2 files changed, 2 insertions(+), 99 deletions(-) diff --git a/README.md b/README.md index 4b78157..46471e4 100644 --- a/README.md +++ b/README.md @@ -1,100 +1,3 @@ # Learn Terraform - Provision AKS Cluster -This repo is a companion repo to the [Provision an AKS Cluster learn guide](https://learn.hashicorp.com/terraform/kubernetes/provision-aks-cluster), containing -Terraform configuration files to provision an AKS cluster on -Azure. - -After installing the Azure CLI and logging in. Create an Active Directory service -principal account. - -```shell -$ az ad sp create-for-rbac --skip-assignment -{ - "appId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", - "displayName": "azure-cli-2019-04-11-00-46-05", - "name": "http://azure-cli-2019-04-11-00-46-05", - "password": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", - "tenant": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" -} -``` - -Then, replace `terraform.tfvars` values with your `appId` and `password`. -Terraform will use these values to provision resources on Azure. - -After you've done this, initalize your Terraform workspace, which will download -the provider and initialize it with the values provided in the `terraform.tfvars` file. - -```shell -$ terraform init - -Initializing provider plugins... -- Checking for available provider plugins on https://releases.hashicorp.com... -- Downloading plugin for provider "azurerm" (1.27.0)... - -Terraform has been successfully initialized! -``` - - -Then, provision your AKS cluster by running `terraform apply`. This will -take approximately 10 minutes. - -```shell -$ terraform apply - -# Output truncated... - -Plan: 3 to add, 0 to change, 0 to destroy. - -Do you want to perform these actions? - Terraform will perform the actions described above. - Only 'yes' will be accepted to approve. - -# Output truncated... - -Apply complete! Resources: 3 added, 0 changed, 0 destroyed. - -Outputs: - -kubernetes_cluster_name = light-eagle-aks -resource_group_name = light-eagle-rg -``` - -## Configure kubectl - -To configure kubetcl run the following command: - -```shell -$ az aks get-credentials --resource-group light-eagle-rg --name light-eagle-aks; -``` - -The -[resource group name](https://github.com/hashicorp/learn-terraform-provision-aks-cluster/blob/master/aks-cluster.tf#L16) -and [AKS name](https://github.com/hashicorp/learn-terraform-provision-aks-cluster/blob/master/aks-cluster.tf#L25) - correspond to the output variables showed after the successful Terraform run. - -You can view these outputs again by running: - -```shell -$ terraform output -``` - -## Configure Kubernetes Dashboard - -To use the Kubernetes dashboard, we need to create a `ClusterRoleBinding`. This -gives the `cluster-admin` permission to access the `kubernetes-dashboard`. - -```shell -$ kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard --user=clusterUser -clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created -``` - -Finally, to access the Kubernetes dashboard, run the following command: - -```shell -$ az aks browse --resource-group light-eagle-rg --name light-eagle-aks -Merged "light-eagle-aks" as current context in /var/folders/s6/m22_k3p11z104k2vx1jkqr2c0000gp/T/tmpcrh3pjs_ -Proxy running on http://127.0.0.1:8001/ -Press CTRL+C to close the tunnel... -``` - - You should be able to access the Kubernetes dashboard at [http://127.0.0.1:8001/](http://127.0.0.1:8001/). +This repo is a companion repo to the [Provision an AKS Cluster learn guide](https://learn.hashicorp.com/terraform/kubernetes/provision-aks-cluster), containing Terraform configuration files to provision an AKS cluster on Azure. \ No newline at end of file diff --git a/terraform.tfvars b/terraform.tfvars index 3c2623d..7183313 100644 --- a/terraform.tfvars +++ b/terraform.tfvars @@ -1,2 +1,2 @@ appId = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" -password = "********-****-****-****-************" \ No newline at end of file +password = "********-****-****-****-************"