In the spirit of the Deploy Zenko anywhere series, I would like to guide you through deploying Zenko on AKS (Azure Kubernetes Service) today. Azure is a constantly expanding worldwide network of data centers maintained by Microsoft.
You can find previous tutorials on how to deploy Zenko here:
Prerequisites
Initial VM
We are going to create an initial virtual machine on Azure that will be used to spin up and manage a Kubernetes cluster later. But first, create a resource group. Azure uses the concept of resource groups to group related resources together. We will create our computational resources within this resource group.
az group create\ --name=<YourResourceGroupName>\ --location=centralus
After that, you can follow this tutorial to create a virtual machine. It is pretty straight forward.
Things I want to mention:
- choose your resource group within which the virtual machine is created
- choose CentOS operating system
- create a public IP address
- expose SSH and HTTP ports at least
- add your local computer’s (the one you will use to connect to VM) SSH public keys, as we need a way to connect to the machine later
Once the VM is created, you can connect to it through SSH and the public IP address from your local computer.
Azure CLI
To use the Kuberenetes Service on Azure, we need a command line tool to interact with it. You can choose between Azure interactive shell or installing the command line tool locally. In this case, I find CLI far easier to work with.
Install the Azure CLI tool on the new VM and try to login into Azure. This command will take you to a web browser page where you can confirm the login info.
az login
Create a Kubernetes cluster
To keep things neat, I suggest creating a directory inside the VM:
mkdir <ClusterName> cd <ClusterName>
To secure your future cluster, generate SSH keys and:
ssh-keygen -f ssh-key-<ClusterName>
It will prompt you to add a passphrase, which you can leave empty if you wish. This will create a public key named ssh-key-<ClusterName>.pub and a private key named ssh-key-<ClusterName> in the folder we created.
The following command will request a Kubernetes cluster within the resource group that we created earlier:
az aks create --name <ClusterName> \ --resource-group <YourResourceGroupName> \ --ssh-key-value ssh-key-<ClusterName>.pub \ --node-count 3 \ --node-vm-size Standard_D2s_v3
In the code above:
- –name is the name you want to use to refer to your cluster
- –resource-group is the resource group you created in the beginning
- –ssh-key – value is the SSH public key created for this cluster
- –node – count is the number of nodes you want in your Kubernetes cluster (I am using 3 for tutorial)
- –node-vm-size is the size of the nodes you want to use, which varies based on what you are using your cluster for and how much RAM/CPU each of your users needs. There is a list of all possible node sizes for you to choose from, but not all might be available in your location. If you get an error whilst creating the cluster you can try changing either the region or the node size.
- It will install the default version of Kubernetes. You can pass –kubernetes-version to install a different version.
This might take some time. Once it is ready you will see information about the new Kubernetes cluster printed in the terminal.
Install Kubernetes CLI
To work with the cluster we need to install kubectl, the Kubernetes command line tool. Run the following command:
az aks install-cli
The next step is to get credentials from Azure:
az aks get-credentials --name <ClusterName> --resource-group <YourResourceGroupName>
Now if I run this command, I get all my nodes and the status on each:
It looks good, we can move on.
Install Helm
Helm is the first application package manager running atop Kubernetes, and we can use the official Zenko helm charts to deploy it to our cluster. It allows describing the application structure through convenient helm charts and managing it with simple commands.
1. Download helm v2.13.1
2. Unpack it and move it to its desired destination :
tar -zxvf helm-v2.13.1-linux-386.tar.gz mv linux-386/helm /usr/local/bin/helm
helm version
The first service we need is a tiller, it runs inside of your Kubernetes cluster and manages releases (installations) of your charts. Create a serviceaccount for tiller:
kubectl create serviceaccount tiller --namespace kube-system
Create rbac-config.yaml that will configure tiller service:
kind: ServiceAccount metadata: name: tiller namespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: tiller roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: tiller namespace: kube-system
Lastly, apply rbac-config.yaml file :
kubectl apply -f rbac-config.yaml helm init --service-account tiller
Install Zenko
Get the latest release of Zenko or the one that you prefer from here:
wget https://github.com/scality/Zenko/releases/tag/1.0.2-hotfix.1 unzip 1.0.2-hotfix.1.zip
Go to the kubernetes folder and run the following commands that will deploy Zenko:
cd Zenko-1.0.2-hotfix.1/kubernetes helm init helm install --name zenko --set ingress.enabled=true --set ingress.hosts[0]=zenko.local --set cloudserver.endpoint=zenko.local zenko
This step may take up to 10 minutes. After the setup is done, you can run this command to see all Zenko pods and their availability:
kubectl get pods
Wait a few more minutes for all services to be started and run this command to get your Instance ID, you will need it to connect to Orbit:
kubectl logs $(kubectl get pods --no-headers=true -o custom-columns=:metadata.name | grep cloudserver-manager) | grep Instance | tail -n 1
Connect your instance to Orbit
Once you got the Instance ID copy it and go to Orbit signup page. After signup, you will have a choice to start sandbox or connect existing instance – that is what you need. Enter your ID and create a name for your Zenko cluster. Done! Start managing data.