Google Cloud Platform

Prerequisites

To deploy a cluster in your Google Cloud Platform (GCP) account with Kublr, you’ll need to create a GCP service account and a private key.

  1. Log in to your Google Cloud Platform Console.
  2. On the top left click Expand to expand the menu.
  3. In the menu click IAM & admin.
  4. On the IAM & admin page select Service Accounts on the left menu and click Create Service Account at the top of the page.
  5. Fill out the form, click Furnish a new private key, and choose JSON. Furnish a New Private Key
  6. Click the Save button. Your JSON key will be downloaded and placed in your downloads directory. This file will be necessary to add your credentials to Kublr.

Overview

This document describes the steps necessary to demonstrate how Kublr works by creating a cluster in Google Cloud Platform infrastructure and deploying a simple application (WordPress).

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

Connect GCP 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. Select GCP Credentials in the drop-down selector field . Credentials Type Dropdown
  5. Enter Credentials Name (e.g. gcp-credentials).
  6. Copy and paste the Project ID which can be found in the JSON key file that was downloaded earlier.
  7. Copy and paste the Client Email which can be found in the JSON key file that was downloaded earlier.
  8. Copy and paste the Private Key which can be found in the JSON key file that was downloaded earlier.
  9. After the form is complete click Save Credentials at the bottom right. You should see a success notification if everything is correct. Success Adding Credentials
  10. To verify that the credentials are valid click the Verify Credentials Button button. Credential
  11. You should see a success notification, indicating that the credentials are valid. Verify Credentials Success

Create GCP Cluster in Kublr

  1. Click on Cluster Menu in the left navigation menu bar Cluster Menu
  2. Click on Add Cluster Add New Cluster
  3. Enter cluster name Cluster Name
  4. Select the Google Cloud Platform provider GCP Provider
  5. Select the credentials created earlier Select Credentials
  6. Select Region Select Region
  7. Select the 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 Work Nodes
  10. Click Cnfirm and Install at the bottom right of the screen.
  11. If everything was entered correctly a congratulations notification will be displayed on the screen. Cluster Created

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

Initiate and test your 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 to get a 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 a 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.