Kublr: Amazon Web Services

Prerequisites

To deploy a cluster in your AWS account with Kublr, you’ll need to create an AWS policy and an AWS API Access Key. Please refer to Register AWS Policy, create User and Create API Credentials.

Overview

This document describes the steps necessary to show how Kublr works by creating a cluster in an Amazon Web Services infrastructure and deploying a simple application (WordPress). It contains the following steps:

  1. Deploy Kublr Cluster to AWS infrastructure.
  2. Open deployed Kublr Cluster.
  3. Configure kubectl.
  4. Use Helm to deploy WordPress to the cluster.

Connect Kublr and create a Cluster AWS

Connect AWS and Kublr

  1. Log into Kublr using your credentials.
  2. Click on the Credentials menu in the left navigation menu bar. Credentials
  3. Click Add Credentials Add Credentials
  4. Under credential type, select AWS Credentials.
  5. Enter Credentials Name (e.g. Test).
  6. Enter Access Key from AWS Management Console / IAM (see above).
  7. Enter Secret Key from AWS Management Console / IAM (see above).
  8. Click Save Credentials.
  9. “Credentials have been successfully created” popup appears.
  10. Click to verify if credentials are valid and ready to be used Verify Credentials Verify Credentials Success

Create a Kubernetes Cluster in Kublr

  1. Click on Cluster Menu in the left navigation menu bar Cluster Menu
  2. Click on Add New Cluster Add New Cluster
  3. Enter cluster name Cluster Name
  4. Select Provider: Amazon Web Services AWS Provider
  5. Select Region Select Region
  6. Select credentials created and/or saved in step 2.
  7. Select operating system to be used for Kublr cluster instances Select OS
  8. Select the number of master nodes and instance type Select Instance Type
  9. Select the number of worker nodes and instance type Select Word Nodes
  10. Click Confirm and Install. A notification box stating “Your cluster is being created. It might take a few minutes.” will appear.

kubectl

Install and Configure kubectl

For more details, please refer to the official Kubernetes documentation

For Mac users:

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

For Windows users:

  1. Download https://storage.googleapis.com/kubernetes-release/release/v1.10.3/bin/windows/amd64/kubectl.exe
  2. Include the path with the kubectl executable to PATH environment variable. More details: https://msdn.microsoft.com/en-us/library/office/ee537574(v=office.14).aspx
  3. See additional information here

Copy KubeConfig File

To retrieve the config from Kublr:

  1. Click on cluster in the cluster list to access the cluster details page
  2. On the overview tab, download the config file Config File

For Mac users:

mkdir ~/.kube
cp ~/Downloads/config.yaml ~/.kube/config

For Windows users:

cd %HOME%
mkdir .kube
copy %HOME%\Downloads\config.yaml .kube\config

Check that kubectl is working and using right config file:

kubectl config view
kubectl cluster-info

Helm

Install and Use Helm to Deploy WordPress to Your Cluster

Install helm Click here for detailed guidelines.

For Mac users:

curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
chmod +x get_helm.sh
./get_helm.sh --version v2.9.1

For Windows users:

  1. Download helm version 2.9.1 from here: https://github.com/kubernetes/helm/releases:
  2. Extract helm-v2.9.1-windows-amd64.zip to the directory where kubectl is saved

Init and test Helm installation:

helm init

Install WordPress

NOTE: It may take a few minutes for the LoadBalancer IP to become available.

helm install stable/wordpress --name wordpress

For Mac users:

export SERVICE_IP=$(kubectl get svc --namespace default wordpress-wordpress -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
echo http://$SERVICE_IP/admin
echo Username: user
echo Password: $(kubectl get secret --namespace default wordpress-wordpress -o jsonpath='{.data.wordpress-password}' | base64 --decode)

Install helm output Open the browser and navigate to the URL from console output.

For Windows users:

  1. Run the following commands to get hostname and password:

    kubectl get svc --namespace default wordpress-wordpress -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
    kubectl get secret --namespace default wordpress-wordpress -o jsonpath='{.data.wordpress-password}
  2. Open browser to http://%hostname%/admin, where %hostname% is the hostname you got from the kubectl

  3. Decode admin password with https://www.base64decode.org/

Congrats! You just deployed your first app in a Kubernetes cluster with Kublr.


Questions? Suggestions? Need help? Contact us.