This tutorial is a walk-through of how to failover MySQL on Google Kubernetes Engine (GKE)…
October 9, 2018
Kubernetes Tutorial: How to Install Portworx on Google Kubernetes Engine (GKE)
This tutorial is a walk-through of how to install Portworx on Google Kubernetes Engine (GKE) by Certified Kubernetes Administrator (CKA) and Application Developer (CKAD) Janakiram MSV.
Janakiram MSV: Hi! In this demo, I’m going to show you how to install Portworx on Google Kubernetes Engine. Before we get started with the installation, we need to meet a prerequisite, which is installing an etcd cluster on our Kubernetes cluster. To do that, I’m going to take help of the etcd Operator provided by CoreOS. Once we install etcd in the cluster, we’re going to grab the cluster IP of the service on which etcd is available and feed this to the Portworx spec generator, which is going to be the second step of this demo.
So, let me walk you through the environment. What you see here is a standard GKE cluster that is not specifically configured for Portworx. It’s a plain vanilla GKE cluster with default options running in region asia-south1 which is Mumbai. My kubectl is already configured for GKE cluster. As you see, there are three nodes running a very specific version of Kubernetes meant for GKE, which is 1.9.7. Now the very first step as I mentioned is to go ahead and install etcd. To make this simpler, I have created a shell script, so I’m going to run this and this is going to install etcd in just a few seconds. And as soon as etcd service is available, we want to make a node of the service cluster IP address because that is required for Portworx to get installed. This is going to take just a couple of minutes because it’s going to install the etcd operator.
For instructions on installing the etcd operator, refer to the GitHub repo of the CoreOS etcd operator. So let’s give this a second and it looks like our service is up and running and it’s available at this specific cluster IP address. So we’ll come back and revisit this. With the first step done, let me show you the spec generator for Portworx meant for Kubernetes. There are four configuration options as you see here. This is a wizard-style configuration tool to install Portworx on Kubernetes. So we need to populate certain details. The very first option that we need to provide is the version of Kubernetes that we are running. So to make this simple, there is a command, a CLI, that we need to run. So I’m going to copy paste this to get the version of Kubernetes. I’m going to copy this and paste it here. So, this is the version of Kubernetes. Then we need to point Portworx to the etcd operator that we just installed, so for that, I need to copy and paste the etcd location where the service is available. So, this is going to be the location or the end point where etcd operator is available.
That’s the first part of the configuration. Let’s move to the next. Here we need to choose whether we are installing Portworx on-prem or in the cloud. Since we are targeting GKE, I’m going to choose cloud and here point to Google Cloud or GKE. As soon as we select that, we can configure the Disk Type. If we are running high IO, high throughput databases, we are going to choose an SSD type. So we’ll choose the volume type as SSD and 10 GB for the size and leave the remaining options as is. This is to configure the network which we are not going to change for this demo, so we’ll leave this with the defaults. And finally, to ensure that Portworx is customized for the target environment, there are certain options which is basically the target deployment environment, and as you notice there is GKE. So we are going to select this radio button and click on Finish.
Now, this is going to give us a long URL, where our specification is available. This is essentially a YAML file that’s generated based on the inputs that we have given. If you’re interested, you can also download this spec but we can safely copy this command and run it in our environment. Before that let me split the window because I want to monitor the entire progress. So we are now running two instances of the terminal just to make sure that we are able to watch the progress. So, now I’m going to run this command which we copied from the Portworx spec generator. This is going to install Portworx in the kube-system namespace and as you noticed, it created a DaemonSet called Portworx along with a bunch of other artifacts.
Now I’m going to take help of a script. First, we’ll make sure that we are setting up the context to kube-system because we are going to run a lot of commands targeting this namespace, so running this command will ensure we’re always talking to the kube-system namespace. Then let’s keep an eye on three pods because we are running a three-node cluster and because Portworx is installed as a DaemonSet, let’s keep an eye on this. And as you notice, there are three pods that are deployed as a part of the DaemonSet primarily mapping to each of the nodes available in our GKE cluster.
Now, what we’re going to do is to check the logs, so I’m going to grab the pod name, one of the pod names. So, if you actually do an echo PX_POD it will point to one of the pods, the first one. Then we are going to run kubectl logs -f and this is going to show us the logs generated by one of the pods from the DaemonSet. This is going to take a couple of minutes. The installer of Portworx is going to pull quite a few images and as you notice, it’s currently pulling from the registry and in a couple of minutes it’s going to bootstrap and configure itself. Our goal is to make sure that the three pods that we see here should be moving to running state with one of one, that is every pod being in the ready state. So you’re going to see a lot of action on the console because it’s going to configure itself on every node and in a couple of minutes all the three pods will be completely ready, indicating that Portworx is successfully installed. So let’s give it some time.
Alright, now we’re actually seeing that the PX node status is reporting that Portworx service is healthy, which is an indication that the cluster is up and running and we also notice that all the three nodes are in ready state with the status being “Running”. The other way to verify whether Portworx is successfully installed or not is to check your GCP console. So when we move to the compute engine disks section of the console, you’ll notice that there are three disks that are created of 10 GB each.
This is based on the spec that we created earlier. So the disks that are named as “PX-do-not-delete” are created as a part of the Portworx installation because during this spec generation we mentioned that we need an SSD disk of 10 GB each. So every node is now attached to a volume which has 10 GB based on an SSD back-end. And, of course, the Pods are also reporting to be healthy and all of them are in the running status. This is an indication that everything has gone perfectly well and this is how you install Portworx on Google Kubernetes Engine. Thanks for watching.