Git Product home page Git Product logo

aks-infrastructure's Introduction

Deploy

Azure Kubernetes Service (AKS) Cluster and Helm Chart

This example demonstrates creating an Azure Kubernetes Service (AKS) Cluster, and deploying a Helm Chart into it, all in one Pulumi program. Please see https://docs.microsoft.com/en-us/azure/aks/ for more information about AKS.

Prerequisites

Ensure you have downloaded and installed the Pulumi CLI.

We will be deploying to Azure, so you will need an Azure account. If you don't have an account, sign up for free here. Follow the instructions here to connect Pulumi to your Azure account.

This example deploys a Helm Chart from Bitnami's Helm chart repository, so you will need to install the Helm CLI and configure it:

$ helm init --client-only
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm repo update

Running the Example

After cloning this repo, cd into it and run these commands. A Kubernetes cluster and Apache web server will appear!

  1. Create a new stack, which is an isolated deployment target for this example:

    $ pulumi stack init
  2. Set the required configuration variables for this program:

    $ pulumi config set azure:environment public
    $ pulumi config set password --secret [your-cluster-password-here]
    $ ssh-keygen -t rsa -f key.rsa
    $ pulumi config set sshPublicKey < key.rsa.pub
  3. Deploy everything with the pulumi up command. This provisions all the Azure resources necessary, including an Active Directory service principal, AKS cluster, and then deploys the Apache Helm Chart, all in a single gesture:

    $ pulumi up
  4. After a couple minutes, your cluster and Apache server will be ready. Three output variables will be printed, reflecting your cluster name (cluster), Kubernetes config (kubeConfig) and server IP address (serviceIP).

    Using these output variables, you may curl your Apache server's serviceIP:

    $ curl $(pulumi stack output serviceIP)
    <html><body><h1>It works!</h1></body></html>

    And you may also configure your kubectl client using the kubeConfig configuration:

    $ pulumi stack output kubeConfig > kubeconfig.yaml
    $ KUBECONFIG=./kubeconfig.yaml kubectl get service
    NAME            TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                      AGE
    apache-apache   LoadBalancer   10.0.125.196   40.76.52.208   80:32080/TCP,443:31419/TCP   9m
    kubernetes      ClusterIP      10.0.0.1       <none>         443/TCP                      13h
  5. At this point, you have a running cluster. Feel free to modify your program, and run pulumi up to redeploy changes. The Pulumi CLI automatically detects what has changed and makes the minimal edits necessary to accomplish these changes. This could be altering the existing chart, adding new Azure or Kubernetes resources, or anything, really.

  6. Once you are done, you can destroy all of the resources, and the stack:

    $ pulumi destroy
    $ pulumi stack rm

aks-configured-service

aks-infrastructure's People

Contributors

hamdialaa avatar

Watchers

James Cloos avatar  avatar

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.