Infoblox Deployment Guide - Infoblox Kubernetes 1.0.0 IPAM ... · Kubernetes is an open source...

Post on 20-May-2020

52 views 0 download

Transcript of Infoblox Deployment Guide - Infoblox Kubernetes 1.0.0 IPAM ... · Kubernetes is an open source...

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 1 of 18

DEPLOYMENT GUIDE

Infoblox Kubernetes1.0.0 IPAM PluginNIOS version 8.X | November 2019

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide November 2019 Page 2 of 18

Overview .......................................................................................................................................... 3

Introduction ................................................................................................................................ 3

Kubernetes .......................................................................................................................... 3

Docker ................................................................................................................................. 3

Infoblox IPAM plugin for Kubernetes .................................................................................. 3

Use Cases ................................................................................................................................. 3

Automatic IP Address Assignment ...................................................................................... 3

Deployment ...................................................................................................................................... 4

Docker Installation ..................................................................................................................... 5

Cleaning up Older Versions ................................................................................................ 5

Setting up the Docker Repository ....................................................................................... 6

Verify Installation ................................................................................................................. 7

Kubernetes installation .............................................................................................................. 7

Setting up the kubernetes repository .................................................................................. 7

Configure cgroup driver used by kubelet ............................................................................ 8

Reload and restart the Kubelet daemon ............................................................................. 8

Run the following commands ONLY on master node ......................................................... 8

Commands to be executed on Nodes (Node1 and Node2) ................................................ 9

Downloading and Installing Infoblox plugin ....................................................................... 10

Checking Infoblox IPAM plugin configuration files and binary in the Nodes ..................... 13

Creating Pods ................................................................................................................... 14

Grid View of Infoblox IPAM plugin for Kubernetes ............................................................ 15

Getting the Pod information from the Cloud View ............................................................. 16

Deleting the Pods .............................................................................................................. 17

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide Page 3 of 18

Overview

Introduction

Kubernetes

Kubernetes is an open source platform that automates container (Docker and Rocket) operations. It

eliminates many of the manual processes involved in deploying and scaling containerized applications. In

other words, you can cluster together groups of hosts (called nodes) running containers, and Kubernetes

helps you easily and efficiently manage those clusters. These clusters can span hosts

across public, private, or hybrid clouds.

Containers provide a different take on virtualization. In traditional virtualization, an entire computer

platform is virtualized, including its operating system/kernel. With containers, the operating system

becomes a shared resource and only the software deployed in the container is isolated. This consolidates

system resources, providing a more efficient, streamlined and lightweight infrastructure.

Docker

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.

Containers allow a developer to package up an application with all the parts it needs, such as libraries

and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the

developer can rest assured that the application will run on any other Linux machine regardless of any

customized settings that machine might have that could differ from the machine used for writing and

testing the code.

Infoblox IPAM plugin for Kubernetes

The Infoblox IPAM plugin for Kubernetes is a managed plugin that interfaces with Infoblox to provide IP

Address Management services for Infoblox managed Pods. The Infoblox IPAM plugin for Kubernetes is

open source and can be downloaded from GitHub.

This deployment guide will walk you through the steps of installing, using Kubernetes and the Infoblox

IPAM plugin.

Use Cases

Automatic IP Address Assignment

As containers become more prevalent across an organization, the ability to assign IP addresses that are

routable and that follow the organization’s policies becomes more critical. If an organization is using a

spreadsheet and/or manual processes for IP address assignment across the organization, the dynamic

and agile container world will quickly break the traditional manual IP address assignment processes. In

addition, when containers are destroyed, the IP addresses should be documented and released—but

most IT teams do not focus on reclamation and clean up.

The Infoblox IPAM Adapter for Kubernetes provides the pre-built and tested interaction to support IP

address automation in container environments. Instead of manually allocating IP addresses, Infoblox

automatically assigns IP addresses with flexible configuration options with separate or combined address

space per host or hub. This automation reduces deployment times and eliminates the risk of overlapping

and conflicting IP addresses. Reporting views track current and historical data for improved visibility.

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide Page 4 of 18

Deployment

This guide assumes that Kubernetes will be installed on 3 machines One Master and 2 Nodes. All the

machines are running Ubuntu 16.04 Server OS. All the machines are part of same subnet with Internet

access.

Please make sure that machines have corresponding host name entry in /etc/hosts file.

/etc/hosts file for the Master node

/etc/hosts file for the Node01 node

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 5 of 18

/etc/hosts file for the Node02 node

Docker Installation

Docker is supported on multiple platforms and the installation steps will vary depending on the platform

you are installing it on. Installation instructions can be found through the download page for the version of

Docker that you will be using. There may also be multiple methods that can be used to complete the

installation, including the use of repositories, an RPM package, or with automated convenience scripts.

In this guide, we demonstrate the installation of the version 17.03 of Docker CE on Ubuntu using

repositories, a commonly used installation method. Additional instruction details can be found at

https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/.

Cleaning up Older Versions

Run following commands on all 3 machines.

Before beginning the installation of Docker, it is recommended to remove any older versions and their

associated dependencies. To do this, type the following command:

If no older versions have been previously installed, you may see output such as the following:

sudo apt-get remove docker docker-engine docker.io

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 6 of 18

Proceed to the next step once complete.

Setting up the Docker Repository

When installing Docker for the first time, you will first need to setup the Docker repository (a one-time

step). After the repository has been configured, the installation and any upgrades are done from the

repository.

To setup the Docker repository: 1. Update the apt-get package index using:

2. Install the curl utility using

3. Install https related packages required to enable connectivity to the repository over https:

4. Add the official GPG key for Docker:

5. Run the following command to confirm that the key was successfully added.

6. Install the docker container engine

apt-get remove docker docker-engine docker.io

[sudo] password for infoblox:

Reading package lists... Done Building dependency tree Reading state information... Done Package 'docker-engine' is not installed, so not removed Package 'docker' is not installed, so not removed Package 'docker.io' is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.

apt-get update

apt-get install curl

apt-get install \

apt-transport-https \

ca-certificates \

software-properties-common

Note: Copy and paste each line at a time in step 3. Don’t copy and paste

all of them at once as you will run into a problem executing the command.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb

[arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs)

stable"

apt-get update && apt-get install -y docker-ce=$(apt-cache

madison docker-ce | grep 17.12.1 | head -1 | awk '{print $3}')

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 7 of 18

Verify Installation

The Docker daemon starts automatically once the installation completes successfully. To verify that Docker has been successfully installed and is running, run the command “docker --version ”:

This will display the current version of docker.

Kubernetes installation

Run following commands on all 3 machines

Setting up the kubernetes repository

Use the following commands to set up the kubernetes repository and to install kubernetes. You can copy

the commands shown in the box and directly paste in the command line.

1. sudo swapoff -a

2. apt-get update && apt-get install -y apt-transport-https curl

3. curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key

add -

4. cat <<EOF >/etc/apt/sources.list.d/kubernetes.list

deb http://apt.kubernetes.io/ kubernetes-xenial main

EOF

Note: Copy and paste each line at a time in step 4. Don’t copy and

paste all of them at once as you will run into a problem executing the

command.

5. apt-get update

6. apt-get install -y kubelet=1.9.4-00 kubeadm=1.9.4-00 kubectl=1.9.4-00

root@master:~# docker --version

Docker version 17.12.1-ce, build f5ec1e2

sudo swapoff -a

apt-get update && apt-get install -y apt-transport-https curl

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg \

| apt-key add –

cat <<EOF >/etc/apt/sources.list.d/kubernetes.list

deb http://apt.kubernetes.io/ kubernetes-xenial main

EOF

apt-get update

apt-get install -y kubelet=1.9.4-00 kubeadm=1.9.4-00 kubectl=1.9.4-00

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 8 of 18

Configure cgroup driver used by kubelet

Navigate to the /etc/systemd/system/kubelet.service.d/ directory to edit 10-kubeadm.conf file and

add the following parameter --cgroup-driver=cgroupfs in Environment section.

Sample Output:

Reload and restart the Kubelet daemon

1. systemctl daemon-reload

2. systemctl restart kubelet

Run the following commands ONLY on master node

1. swapoff -a

2. kubeadm init

Note: This command will take some time to execute and will generate an output like this:

Please make a note of the command highlighted in the red box. We will run this command

on all nodes (Node1 and Node2) to join them to the master. 3. mkdir -p $HOME/.kube

4. sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

5. sudo chown $(id -u):$(id -g) $HOME/.kube/config

6. export KUBECONFIG=/etc/kubernetes/admin.conf

systemctl daemon-reload

systemctl restart kubelet

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 9 of 18

Commands to be executed on Nodes (Node1 and Node2)

On the NODES, run the command which we obtained from step 2 in the previous section.

kubeadm join 10.196.200.22:6443 --token bltz2g.2kc3wj1rza0yfm2v --discovery-

token-ca-cert-hash

sha256:fb5886f96e278a4c97434b2dc11814486a8e81b6ea805658bd301f7a92ef1e7f

Note: Please replace the values in Red with your environment specific details.

Sample Output:

Verifying Nodes Status

To verify that the nodes are registered in the master, please run the following command in the master VM

swapoff -a

kubeadm init

mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

export KUBECONFIG=/etc/kubernetes/admin.conf

kubeadm join master_ip_address:6443 --token token --discovery-token-ca-cert-

hash sha256:generated_sha_thumbprint

kubectl get nodes

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 10 of 18

Sample Output:

Note : Sometimes STATUS shows as Not Ready. It is a known issue and can be safely ignored.

Downloading and Installing Infoblox plugin

Login to the master and run the following commands

1. git clone https://github.com/infobloxopen/cni-infoblox

This command will create a cni-infoblox folder and will download the Infoblox Kubernetes plugin

files to it. cd to this folder.

Sample Output:

2. Change directory to k8s

Sample:

git clone https://github.com/infobloxopen/cni-infoblox

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 11 of 18

“k8s” folder has Infoblox IPAM plugin related files. We will modify some of these files to integrate

Infoblox grid with the Kubernetes.

3. Edit the cni-infoblox-daemon.yaml file (nano cni-infoblox-daemon.yaml) and update the Infoblox

Grid IP under “args” section

Sample:

4. Edit the cni-infoblox-plugin.yaml file and update the master interface name under “data”

section. Also update your container network “subnet” which you are planning to deploy. You can

also define the network view name under “network-view” section. We will leave it as

“cni_view”.

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 12 of 18

a. Interface name can be obtained by running ip a command

Sample:

5. To create the cni-infoblox-daemon run the following command under cni-infoblox/k8s directory

Sample:

6. Verify the creation of Infoblox daemon by running following command

Sample:

7. Install the Infoblox IPAM plugin by running the following command under cni-infoblox/k8s

directory

Sample:

8. Verify the creation of Infoblox plugin pod by running following command

kubectl create -f cni-infoblox-daemon.yaml

kubectl get pods --all-namespaces -o wide

kubectl create -f cni-infoblox-plugin.yaml

kubectl get pods --all-namespaces -o wide

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 13 of 18

Sample:

Checking Infoblox IPAM plugin configuration files and binary in the Nodes

By design, it is not required to install the Infoblox IPAM plugin on each of the nodes saperately. Master

itself pushes the Infoblox IPAM plugin configuration files and binaries to the Nodes.

Perform these actions on all the nodes

1. Login to the first node and navigate to the /etc/cni/net.d directory.

Sample:

2. You will see 2 files in /etc/cni/net.d directory. Open the infoblox-ipam.conf file and verify the

contents. Subnet details and network-view should be identical to the master VM.

Sample:

3. To check the binary navigate to the /opt/cni/bin directory

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 14 of 18

Sample:

You will see the infoblox binary present in the /op/cni/bin directory

Repeat this on the other node as well.

Creating Pods

1. Navigate to the cni-infoblox directory which we created in master node under Downloading and

Installing Infoblox plugin section. You will see an “example” directory. Navigate to this directoryusing cd command.

Sample:

2. Create a pod by running following command

Sample:

3. Verify that the container creation process has started by running following command

Sample:

kubectl create -f test-app.yml

kubectl get pods

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 15 of 18

Grid View of Infoblox IPAM plugin for Kubernetes

1. Login to the Grid and navigate to the “Data Management” tab. You should see a network view

created as “cni_view”

2. Navigate to “cni_view” network view > IPAM . You should see a 10.0.0.0/24 network created.

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 16 of 18

3. Navigate to the 10.0.0.0/24 network and click on list view. You should see 2 IP addresses

assigned to the pods which we created under Creating Pods section.

4. Login to the master VM and run the following command to get the pod details

Sample:

5. Verify that the name of the Pods and IP addresses match the values in the Infoblox Grid

cni_view >IPAM >List

Getting the Pod information from the Cloud View

1. Login to the Grid and navigate to the “Cloud” tab “Tenants”. Here you will get information

about the Kubernetes cluster. Under VM tab you can find out number of active pods.

kubectl get pods -o wide

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 17 of 18

2. Now click on “VM” tab to get detailed information about the kubernetes pods.

Here we see 4 active pods. We created first 2 pods by running the test-app.yml file. Last 2 pods got

created when we ran cni-infoblox-daemon.yaml file and cni-infoblox-plgin.yaml file as described

under Downloading and Installing Infoblox section . Infoblox plugin runs as a containerized application

in these 2 pods.

Deleting the Pods

1. Login to the master and run the following command under cni-infoblox/example directory to

delete the pods.

Sample:

kubectl delete -f test-app.yml

© 2019 Infoblox Inc. All rights reserved. Infoblox Kubernetes 1.0.0 IPAM Deployment Guide 2019 Page 18 of 18

2. Login to the Infoblox Grid and navigate to Data Management > cni_view > IPAM > List . Verify

that all the pods are deleted.