Going Hybrid with Kubernetes on Google Cloud Platform and Nutanix
Hybrid cloud allows organizations to run a variety of applications either on-premise or in the public cloud. With this approach, enterprises can:
- Increase the speed at which they're releasing products and features
- Scale applications to meet customer demand
- Move applications to the public cloud at their own pace
- Reduce time spent on infrastructure and increase time spent on writing code
- Reduce cost by improving resource utilization and compute efficiency
Hybrid cloud deployments can help deliver the security, compliance and compute power you require with the agility, flexibility and scale you need. Our hybrid cloud example will encompass three key components:
- On-premise: Nutanix infrastructure
- Public cloud: Google Cloud Platform (GCP)
- Open source: Kubernetes and Containers
Google’s experience running our own container-based internal systems inspired us to create Kubernetes, and Google Container Engine, an open source and Google Cloud managed platform for running containerized applications across a pool of compute resources. Kubernetes abstracts away the underlying infrastructure, and provides a consistent experience for running containerized applications. Kubernetes introduces the concept of a declarative deployment model. In this model, an ops person supplies a template that describes how the application should run, and Kubernetes ensures the application’s actual state is always equal to the desired state. Kubernetes also manages container scheduling, scaling, health, lifecycle, load balancing, data persistence, logging and monitoring.
In a first phase, the Google Cloud-Nutanix partnership focuses on easing hybrid operations using Nutanix Calm as a single control plane for workload management across both on-premises Nutanix and GCP environments, using Kubernetes as the container management layer across the two. Nutanix Calm was recently announced at Nutanix .NEXT conference and once publicly available, will be used to automate provisioning and lifecycle operations across hybrid cloud deployments. Nutanix Enterprise Cloud OS supports a hybrid Kubernetes environment running on Google Compute Engine in the cloud and a Kubernetes cluster on Nutanix on-premises. Through this, customers can deploy portable application blueprints that run on both an on-premises Nutanix environment as well as in GCP.
Let’s walk through the steps involved in setting up a hybrid environment using Nutanix and GCP.
The steps involved are as follows:
- Provision an on premise 4-node Kubernetes cluster using a Nutanix Calm blueprint
- Provision a Google Compute Engine 4-node Kubernetes cluster using the same Nutanix Calm Kubernetes blueprint, configured for Google Cloud
- Use Kubectl to manage both on premise and Google Cloud Kubernetes clusters
- Using Helm, we’ll deploy the same Wordpress chart on both on premise and Google Cloud Kubernetes clusters
Provisioning an on-premise Kubernetes cluster using a Nutanix Calm blueprintYou can use Nutanix Calm to provision a Kubernetes cluster on premise, and Nutanix Prism, an infrastructure management solution for virtualized data centers, to bootstrap a cluster of virtualized compute and storage. This results in a Nutanix managed pool of compute and storage that's now ready to be orchestrated by Nutanix Calm, for one-click deployment of popular commercial and open source packages.
You can then select the Kubernetes blueprint to target the Nutanix on-premise environment.
The Calm Kubernetes blueprint pictured below configures a four-node Kubernetes cluster that includes all the base software on all the nodes and the master. We’ve also customized our Kubernetes blueprint to configure Helm Tiller on the cluster, so you can use Helm to deploy a Wordpress chart. Calm blueprints also allow you to create workflows so that configuration tasks can take place in a specified order, as shown below with the “create” action.
Now, launch the Kubernetes Blueprint:
After a couple of minutes, the Kubernetes cluster is up and running with five VMs (one master node and four worker nodes):
Provisioning a Kubernetes cluster on Google Compute Engine with the same Nutanix Calm Kubernetes blueprintUsing Nutanix Calm, you can now deploy the Kubernetes blueprint onto GCP. The Kubernetes cluster is up and running on Compute Engine within a couple of minutes, again with five VMs (one master node + four worker nodes):
You’re now ready to deploy workloads across the hybrid environment. In this example, you'll deploy a containerized WordPress stack.
Using Kubectl to manage both on-premise and Google Cloud Kubernetes clustersKubectl is a command line interface tool that comes with Kubernetes to run commands against Kubernetes clusters.
You can now target each Kubernetes cluster across the hybrid environment and use kubectl to run basic commands. First, ssh into your on-premise environment and run a few commands.
# List out the nodes in the cluster
$ kubectl get nodes
NAME STATUS AGE
10.21.80.54 Ready 16m
10.21.80.59 Ready 16m
10.21.80.65 Ready 16m
10.21.80.67 Ready 16m
# View the cluster config
$ kubectl config view
# Describe the storageclass configured. This is the Nutanix storage volume plugin for Kubernetes
$ kubectl get storageclass
$ kubectl describe storageclass silver
Using Helm, you can deploy the same WordPress chart on both on-premise and Google Cloud Kubernetes clustersThis example uses Helm, a package manager used to install and manage Kubernetes applications. In this example, the Calm Kubernetes blueprint includes Helm as part of the cluster setup. The on-premise Kubernetes cluster is configured with Nutanix Acropolis, a storage provisioning system, which automatically creates Kubernetes persistent volumes for the WordPress pods.
Let’s deploy WordPress on-premise and on Google Cloud:
# Deploy wordpress
$ helm install wordpress-0.6.4.tgz
LAST DEPLOYED: Sun Jul 2 03:32:21 2017
NAME TYPE DATA AGE
quaffing-crab-mariadb Opaque 2 1s
quaffing-crab-wordpress Opaque 3 1s
NAME DATA AGE
quaffing-crab-mariadb 1 1s
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
quaffing-crab-wordpress Pending silver 1s
quaffing-crab-mariadb Pending silver 1s
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
quaffing-crab-mariadb 10.21.150.254 3306/TCP 1s
quaffing-crab-wordpress 10.21.150.73 80:32376/TCP,443:30998/TCP 1s
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
quaffing-crab-wordpress 1 1 1 0 1s
Then, you can run a few kubectl commands to browse the on-premise deployment.
# Take a look at the persistent volume claims
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES AGE
quaffing-crab-mariadb Bound 94d90daca29eaafa7439b33cc26187536e2fcdfc20d78deddda6606db506a646-nutanix-k8-volume 8Gi RWO 1m
quaffing-crab-wordpress Bound 764e5462d809a82165863af8423a3e0a52b546dd97211dfdec5e24b1e448b63c-nutanix-k8-volume 10Gi RWO 1m
# Take a look at the running pods
$ kubectl get po
NAME READY STATUS RESTARTS AGE
quaffing-crab-mariadb-3339155510-428wb 1/1 Running 0 3m
quaffing-crab-wordpress-713434103-5j613 1/1 Running 0 3m
# Take a look at the services exposed
$ kubectl get svc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 10.254.0.1 443/TCP 16d
quaffing-crab-mariadb 10.21.150.254 3306/TCP 4m
quaffing-crab-wordpress 10.21.150.73 #.#.#.# 80:32376/TCP,443:30998/TCP 4m
This on-premise environment did not have a load balancer provisioned, so we used the cluster IP to browse the WordPress site. The Google Cloud WordPress deployment automatically assigned a load balancer to the WordPress service along with an external IP address.
- Nutanix Calm provided a one-click consistent deployment model to provision a Kubernetes cluster on both Nutanix Enterprise Cloud and Google Cloud.
- Once the Kubernetes cluster is running in a hybrid environment, you can use the same tools (Helm, kubectl) to deploy containerized applications targeting the respective environment. This represents a “write once deploy anywhere” model.
- Kubernetes abstracts away the underlying infrastructure constructs, making it possible to consistently deploy and run containerized applications across heterogeneous cloud environments