Development

Shipa Cloud with Your Minikube Cluster

Embracing any new technology stack can certainly be a journey. No matter if this is your first time using Kubernetes or you have been on the Google Borg Team, getting up and started with Shipa Cloud is a breeze. You can bring your own Kubernetes Cluster and sign up for a Shipa Cloud account and you are well on your way to Application as Code excellence. Leveraging minikube is a free way to take a look at Shipa Cloud. 

Kubernetes Pre-Reqs

Taking Shipa Cloud for a cost-free test drive, you can accomplish this with a few moving parts. The first part is a Kubernetes Cluster where you can deploy to. A quick and free Kubernetes Cluster is using minikube on your local machine. If you are using a Mac, installing minikube can be accomplished by leveraging Homebrew

Once Homebrew is installed, run:

brew install minikube
Homebrew install minukube

If using a new variant of Mac OS, an easy hypervisor to use for minikube is HyperKit. You can set minikube to leverage HyperKit. If you have not installed HyperKit before, Homebrew can take care of that also for you. Potentially you might have to install the machine driver if the brew formulae does not have it as a dependency.

brew install docker-machine-driver-hyperkit #optional
brew install hyperkit
Homebrew Install Docker Machine
Homebrew Install HyperKit

Once HyperKit is installed, you can wire minikube to leverage HyperKit. 

minikube config set driver hyperkit
Minikube Config HyperKit

Lastly, depending on your machine size you can make dedicate more resources to minikube. For example I would like 8 gigs of memory dedicated to minikube. 

minikube config set memory 8128
Minikube Set 8GB Memory

Now you are all set to start your minukube cluster. 

minikube start
Minikube Start

With minukube up and running, you can run a kubectl command to validate. Homebrew would have also laid down kubectl for you if installing minkube from Hoembrew. 

kubectl get nodes 
Kubectl Get Nodes

Now you are all set to create your Shipa management plane. 

Getting Started with Shipa Cloud

Once you have signed up for Shipa Cloud, you can login to Shipa Cloud and start on your Shipa journey. 

Shipa Cloud Login

There are a few core concepts to work through. The first item that you will need to define is a Framework. A Shipa Framework is the lifeblood of your Shipa Configuration housing all the controls and policies. 

Shipa Cloud -> Frameworks + Create Framework -> Basic

Shipa Cloud Create Basic Framework

Creating a basic Framework for the example, just name your Framework “myfirstframework”. By default, you have access to a Plan and Team. The defaults for the example are fine. 

Basic Framework Shipa Cloud

Once you click Create, your Framework will be available. 

Your First Shipa Cloud Framework

Wiring Your Kubernetes Cluster to Shipa Cloud

Allowing Shipa Cloud to start to manage your Kubernetes Cluster [in this minukube], you will need a few pieces of authentication from your minikube instance. Shipa Cloud will need an accessible address to your cluster, a Kubernetes authentication token, and CA Certificate. 

Public URL – ngrok

If you run the cluster-info command on your local minukube instance, you will get a local to your network address if you are like myself. 

kubectl cluster-info | grep 'Kubernetes' | awk '/http/ {print $NF}'
Kubectl Cluster IP

Leveraging a service like ngrok, you can expose your local instance, more specifically the Kubernetes API. This guide on ITNEXT is really good for getting started. For evaluation purposes only, you can also expose the Kubernetes API [not recommended for non-examples] to the internet. We will be doing that for this example. 

Sign up and Install ngrok 

You can sign up for a free account with ngrok. Installing the ngrok client is easy with homebrew by running “brew install –cask ngrok

Homebrew Install ngrok

Once installed, you can head to the ngrok setup page and run the authorization command e.g “Connect your account:”

Ngrok Account

Then ngrok authtoken <your_token>

Ngrok Authentication

Once that is connected, you can leverage an HTTP proxy for the Kubernetes API [not recommended for non-examples]

kubectl proxy --disable-filter=true
Proxy All Kubernetes API

Then can fire up ngrok to front the traffic over your localhost and the default Kubernetes API Port e.g 8001. 

ngrok http 8001
ngrok fronting Kubernetes API

Grab the HTTP forwarding address and can save that for the Shipa Cloud Cluster configuration. 

Kubernetes Auth Token

Creating an authorization token based off a Kubernetes role is straightforward. The Shipa Documentation for connecting a cluster gives the needed manifest to create the role and base the token off of. 

Create shipa-admin-service-account.yaml

Shipa Cloud Service Account

Then apply the manifest. 

kubectl apply -f shipa-admin-service-account.yaml

Apply Ship Cloud Service Account

With the service account created, you can grab the authorization token. Can re-run the below command when it is time to copy and paste into Shipa Cloud. 

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep shipa-admin | awk '{print $1}')
Get Authorization Token

You can also grab the CA Certificate for service account by running the following command. Similarly can re-run when needed to copy and paste into Shipa Cloud. 

kubectl get secret $(kubectl get secret | grep default-token | awk ‘{print $1}’) -o jsonpath='{.data.ca.crt}’ | base64 –decode

Get CA Certificate

Adding the Cluster

Once you have the three needed pieces, you can add the cluster to Shipa Cloud. 

Shipa Cloud -> Clusters + Add Cluster 

Can name the cluster “myminikube” and leverage your framework you created earlier e.g “myfirstframework”.

Shipa Cloud Cluster Setup

Click Next and fill out the the connectivity information [HTTP address, token, and certificate] that was just created. 

Configure Shipa Cloud Cluster Connection

Once you click Next, your Cluster will be available! 

Minikube Cluster available in Shipa Cloud

Once your cluster is available, the world is your oyster. Leveraging Shipa Cloud to help drive engineering efficiency across the application stack is now possible. With the wide paintbrush that Shipa and Shipa Cloud offers, the art of the possible is great. 

Cheers,

-Ravi