Installation of Kubernetes on Azure

Kubernetes Introduction

Kubernetes (K8S) is an open-source system for automating deployment, scaling, and management of containerized applications.

It groups containers that make up an application into logical units for easy management and discovery.
Running Kubernetes Cluster on Public Cloud:
While trying to deploy Kubernetes cluster on Public Cloud like azure, there are two options:

  1. Deploy K8S from scratch using ACS engine on azure.
  2. Use one of the turnkey methods like Flannel based or Weave based.

There are many resources describing the Flannel based and the Weave based turnkey solutions for deployment of K8S on Azure, however very few available on deployment of K8S from scratch using ACS engine on azure.
We present a technique of end-to-end deployment of K8S from scratch using ACS engine on azure.

Fig: Installation of K8S on Azure over the network using ACS Engine.

Steps of Kubernetes deployment on Azure

Pre-Requisite:
Installation of git, Python 2.7.9 or greater, docker (latest version).

  1. Installation of Azure CLI on linux host VMAs they say “A great cloud needs a great tools” and hence we need to install azure cli on the linux host VM using,
    $ curl -L https://aka.ms/InstallAzureCli | bash
  2. Installation of Azure CLI on linux host VM
    Pre-Requisite:
    It needs golang being installed on the linux VM host.

    $ apt-get install golang

    Steps for installation of ACS engine on linux host VM.

    1. Setup go path using,
      $ mkdir $HOME/go
    2. Edit
      $HOME/.bash_profile

      and add the following lines to setup your go path

      $ export PATH=$PATH:/usr/local/go/bin
      $ export GOPATH=$HOME/go
      note: if ~/.bash_profile is missing than add the above lines to the ~/.bashrc file.
      $ source $HOME/.bash_profile
    3. Perform some preliminary steps in order to achieve the binary of the acs-engine.
      • Get the local copy of the acs-engine git hub project.
        $ go get github.com/Azure/acs-engine
      • Change the path to,
        $ cd $GOPATH/src/github.com/Azure/acs-engine
      • Install glide using;
        $ sudo add-apt-repository ppa:masterminds/glide
        $ sudo apt-get install glide
        $ sudo apt-get update
        $ glide create
        $ glide install
        $ sudo make
        $ sudo apt-get update
      • Get the binary of the go-bindata;
        $ go get -u github.com/jteeuwen/go-bindata/…
        $ cd ~/GOPATH/bin
        Verify that go-bindata is available in this location.
        $ sudo make (To build the binary of the acs-engine)
        Verify that binary of the acs-engine is created at the location;
        $ ls GOPATH/src/github.com/Azure/acs-engine/bin
  3. Run the acs-engine binary to get the azure command-line parameters.
    $ cd GOPATH/src/github.com/Azure/acs-engine/bin
     $ ./acs-engine
  4. Generating the service PrincipalKubernetes uses a Service Principal to talk to Azure APIs to dynamically manage resources such as User Defined Routes and L4 Load Balancers.Using Azure CLI:
    $ az login
    $ az account set –subscription=“${SUBSCRIPTION_ID}”
    $ az ad sp create-for-rbac –role=“Contributor” --scopes=/subscriptions/${SUBSCRIPTION_ID}

    This will output your appId, password, name, and tenant. The name or appId may be used for the servicePrincipalProfile.servicePrincipalClientId and the password is used for servicePrincipalProfile.servicePrincipalClientSecret

    Confirm your service principal by opening a new shell and run the following commands substituting in name, password, and tenant:

    $ az login --service-principal -u NAME -p PASSWORD –tenant TENANT
    $ az vm list-sizes --location westus
    (Note: replace westus by <resource group location name>
  5. Create a new kubernetes.json file under the example directory in the following path
    $GOPATH/src/github.com/Azure/acs-engine/examples

    Add the following parameters:

    1. SSH Public keys under the values for the “keyData”.This can be obtained from the
      $ cat ~/.ssh/id_rsa.pub
    2. Add values for the keys “servicePrincipalClientID” and for “servicePrincipalClientSecret”.
    3. Add values for “dns-prefix” key under master profile.
    4. Add private ip’s for the master nodes and for the slave nodes under the master profile and in the agent profile.
  6. Generate the new Template deployment
    Run

    $./bin/acs-engine generate examples/kubernetes.json

    to generate the templates in the _output/Kubernetes-UNIQUEID directory. The UNIQUEID is a hash of your master’s FQDN prefix.

  7. Deploying with Azure CLI 2.0
    The generated templates from the step 5 i.e. azuredeploy.json and azuredeployparameters.json in the _output/Kubernetes-UNIQUEID directory can now be used using azure cli to deploy the cluster.
  8. Verification
    To Verify your deployment using below command:
    SSH to k8s-master (use Public IP address or DNS name)

    ssh azureuser@

    Execute below commands and see the output:

    kubectl get nodes # list all nodes in k8s cluster
    kubectl get services --all-namespaces

[Tweet “Installation of #Kubernetes on #Azure ~ via @CalsoftInc”]

 
Share:

Related Posts

Product Lifecycle Management in Software Development using Large Language Models

Product Lifecycle Management in Software Development using Large Language Models

The data of any organization is of extreme value. But what happens when that data is not trustworthy and accessible to your teams? You will face challenges…

Share:
Understanding the Differences Between Public, Private, and Hybrid Cloud Solutions

Understanding the Differences Between Public, Private, and Hybrid Cloud Solutions

Discover the key distinctions between public, private, and hybrid cloud solutions to help choose the right model for your business needs.

Share:
Virtual Machines or Containers Which is Better in NFV Infrastructure

Virtual Machines or Containers. Which is Better in NFV Infrastructure?

Discover whether Virtual Machines or Containers are better for NFV infrastructure. Explore their benefits, challenges, and impact on 5G networks.

Share:
How Server Virtualization Works

How Server Virtualization Works

Discover how server virtualization optimizes hardware utilisation by creating multiple virtual servers on a single physical machine, enhancing efficiency and flexibility in IT environments.

Share:
Understanding Cloud Infrastructure Services

Understanding Cloud Infrastructure Services

Discover how Cloud Infrastructure Services can transform your business with scalable, cost-effective, and agile IT solutions.

Share:
Proven Strategies for Cloud Cost Optimization for Maximum Savings

Proven Strategies for Cloud Cost Optimization for Maximum Savings

Discover proven strategies for cloud cost optimization, reduce waste, and maximize savings with our in-depth guide. Enhance your cloud efficiency today.

Share: