Giter Club home page Giter Club logo

tf-aks's Introduction

Terraform for Azure Kubernetes Services

TF-AKS is for provisioning Azure Kubernetes through Terraform.

Build Status

Usage

Requirements

Preparation

# Download TF-AKS
git clone [email protected]:datadarius/tf-aks.git

# login to azure
az login

# get your subscription id
az account list

# create a service principal for your Cluster.
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/YOURSUBSCRIPTIONID

# Take notes of subscription ID, Service Principal ID (appId), Service Principal Secret (password), you will # need them in the next steps.

# Make sure you have your SSH Pubkey at hand.

Bring up tf-aks

cd terraform-azure-kubernetes-service
terraform init

# Start in interactive mode:
terraform plan -out youraks.out

terraform apply youraks.out

You should now get a working Azure Kubernetes Cluster.

Using tf-aks more automated

You can pass an automatic answerfile to terraform. However, be responsible with the secrets you have to manage. It might e.g. make sense to not store Service Principal or other data in flat files. Have a look at the test.tf-test. You can also use terraform like: terraform apply -var-file=test.tf-test -var 'service_principal=SECRETVALUE' -var 'service_principal_secret=SECRETVALUE'

Production Deployments

Using a Service Principal for Terraform

Pleaese consider using a dedicated SP for Terraform as explained by Hashicorp: https://www.terraform.io/docs/providers/azurerm/authenticating_via_service_principal.html

Terraform Remote State (Recommended for Production use)

In case you are going for a production deployment, you will want to persist your state somewhere remote. TF-AKS includes everything required to bootstrap a Azure File Container which then can be used as a Storage Backend for your Terraform State. As Terraform does not allow creating the backend within the same project it is going to be used, you will have to do this in sequence

Useful Links

ingress IP & Certbot certificate

Azure Rest API

Persistent Volumes for Kubernetes through Azure File

Manual Instructions for az cli

# Creating a Resource Group
az group create -n your-k8s-tf-resources -l westeurope

# Creating an AKS Cluster which has 3 Nodes using k8s version 1.8.7 
az aks create -n your-k8s-cluster -g your-k8s-tf-resources -c 3 -k 1.8.7

# Download the kubeconfig
az aks get-credentials --name your-k8s-cluster --resource your-k8s-tf-resources

# Configuring your local kubectl to use the AKS Cluster
kubectl config use-context your-k8s-cluster

# See how many Nodes are running
kubectl get nodes


# Opening the Kubernetes Dashboard in Browser
az aks browse -n your-k8s-cluster -g your-k8s-tf-resources

tf-aks's People

Contributors

azure-pipelines[bot] avatar datadarius avatar

Watchers

 avatar

Forkers

tkrauss bradaf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.