Nutanix Cloud Native and Calm: Better Together!

Written by Michael Haigh, Technical Marketing Engineer at Nutanix Previously we covered how easy it is for developers and administrators to deploy an application onto Nutanix Cloud Native due to its adherence to open API standards.  We deployed an Oscar e-commerce site, backing it with containers running on Nutanix Karbon, a PostgreSQL database cloned by Nutanix Era, and the static image content stored on Nutanix Buckets.
Nutanix Calm and Nutanix Cloud Native
Today, we’re going automate this entire deployment in Nutanix Calm.  Calm models applications end-to-end using blueprints, allowing you to deploy those applications across clouds and automate their entire lifecycle from creation to deletion, including rolling updates during the application’s lifecycle.  Blueprints can also be published to the Nutanix Markeplace – Calm’s built in self service portal – giving different users and groups direct access to resources without losing control over policy. If you’d like to learn more about Calm, please check out our datasheet here.  
Prerequisite Checklist
Component Requirements Documentation
Nutanix Cloud Native Components See first blog post for more info
Calm Version 2.4.0 Nutanix Calm Upgrade Guide
Karbon Added as a Provider in Calm Nutanix Calm Administration and Operations Guide
 
Nutanix Cloud Native Oscar Application Deployed by Nutanix Calm

Nutanix Calm Blueprint Import

To get started, download the Nutanix Cloud Native Oscar App blueprint, either with a CLI tool like wget, or by opening the link in your browser and saving the page as a JSON file.  Navigate to Calm within your Prism Central instance, select the blueprint icon on the left, and click the “Upload Blueprint” button. In the file browser that pops up, navigate to and select the recently downloaded blueprint.  You’ll then need to give the blueprint a name, and select your project of choice. Be sure to select a project that is tied to your Karbon Kubernetes cluster.
Nutanix Cloud Native Calm Blueprint Upload

Nutanix Calm Blueprint Customization

Next, we’ll need to make some minor modifications to the blueprint to customize it to your environment.  The only two sections that need modification are the credentials, and the application profile variables.  We’ll start with the credentials:
  • era_creds: this is the credential you would use to log in to the UI of your Era server.
  • db_server_creds: this is a private key which will allow for SSH access to the database servers that get deployed via this Calm blueprint.  To generate and output a key, run the following two commands from a Mac or Linux computer:
    ssh-keygen -t rsa -f ~/calmkey -C centos@domain.com
    cat ~/calmkey
  • buckets_creds: this is the Nutanix Buckets endpoint credential that allows read and write access to your bucket.
  • kube_creds: this is our Karbon Kubernetes cluster credential.  Kubernetes deployments in Nutanix Calm are currently Tech Preview, and limited to Deployments, Containers, and Services. In the previous blog post we saw the django-migration.yaml create a kubernetes Job, which seeds our new database with application data. To get around this Tech Preview Calm limitation, within the blueprint we’ll be calling the kubernetes API with these credentials to create the same Job.
Calm Blueprint Credentials
Once your credentials are filled in, click the “Back” button, and fill in the following Application Profile variables, which are along the right pane of your browser.  If you’ve navigated around the blueprint on your own, and they’re no longer on the right pane, then scroll down to the “Application Profile” section of the left pane, and click on the “Default” app profile.
Variable Requires Change? Description
bucket_ip Yes The Nutanix Buckets object storage endpoint IP
buckets_name Yes The name of the pre-created Nutanix Buckets object storage bucket
compute_profile No The desired Compute Profile of your Postgres DB Server
database_parameter No The desired Database Parameters of your Postgres DB
db_name_prefix No Prefix for the database name (a time stamp is appended)
db_password Yes Password for the postgres user, set to any value you’d like
db_public _key Yes The public key that matches the private key in “db_server_creds” which can be outputted with the following command:
cat ~/calmkey.pub
era_ip Yes The IP address of your Era Server
kube_namespace Yes The Kubernetes namespace that will be used for deployment.  If you’re not familiar with adding a namespace set this to ‘default’
kubemaster_ip Yes The IP address of the Karbon Kubernetes Master node.  Can be found with the command:
   kubectl describe node `kubectl get nodes \
       | grep master | awk '{print $1}'` | grep InternalIP
network_profile No The desired Network Profile of your Postgres DB Server
sla_name No The desired Time Machine SLA of the Postgres DB in Era
software_profile No The desired Software Profile of your Postgres DB Server
 
Calm Blueprint Variables
Once you’ve completed filling out the credentials and the variables, save your blueprint.  It is expected that you get yellow Warnings that start with “Macro used in value of key”, however you should not get any red Errors, or other Warnings.

Nutanix Calm Blueprint Launch

While still in the blueprint canvas, click the “Launch” button in the upper right.  On the page that appears, name your application, and optionally change any of the runtime variables that were previously set.  Click the “Create” button, and then on the Application page that you’re directed to, view the status of the deployment from the Audit tab.
Application Manage Tab
Once the deployment is complete (the application will change to a Running state), you’ll access the application in the same manner as last time, by running the following kubectl commands (be sure to substitute in the namespace that you specified via the Calm variable):

kubectl describe nodes | grep InternalIP
kubectl -n <namespace> get svc oscar-django-service

Kubectl commands
Take an IP from the first command, append the 3XXXX port number from the second command, and enter the combination in to a web browser.  You should see the same, fully functional e-commerce website as last time, except now you can manage the entire lifecycle of the application from Nutanix Calm.
Oscar Application Running on Nutanix Cloud Native
Stay tuned for our next post in this series where we’ll be doing a deep dive into how the blueprint works!