Kubernetes
This page describes how to deploy PM415 on Google Cloud using Kubernetes
This PM415 Kubernetes deployment is for demos only - there is no persistence and data loss will occur. For a production deploy you must change the MySQL and Elastic Search Deployment files to include persistent storage, increase the cluster sizes, and enable node-to-node communication in Elastic Search.
Install and configure docker + gcloud
Follow the instructions to install docker and gcloud.
Add Google Container Registry to your docker config:
gcloud auth configure-docker
Login to your Google account:
gcloud auth login
Build and push container image to GCR
Download the PM415 git repository and change directories
git clone https://github.com/mreider/pm415.git
cd pm415
Build a docker image, tag it, and push to Google Container Registry (GCR). Replace the tag with your own Google Cloud Project name according to the format documented here.
docker build --tag gcr.io/pm415-238921/pm415 .
docker push gcr.io/pm415-238921/pm415
Create a Kubernetes cluster
Login to Google Cloud and navigate to Kubernetes Engine
Choose Create cluster
Choose Standard cluster and accept all the defaults
Click Create
Create a kubectl config
Install kubectl using these instructions
Return to the Kubernetes Engine page in the Google Cloud Console and click edit icon.

When the edit screen appears - write down the Endpoint IP address.
Click Show credentials and copy the certificate to your clipboard In a terminal
Convert the certificate to base64 - the following works on a mac:
pbpaste | base64
Return to the cluster credential window and copy the admin password
Create a file named config.yml
with the following contents:
kind: Config
apiVersion: v1
clusters:
- cluster:
server: https://(paste the endpoint IP address)
certificate-authority-data: (paste the base64 cert here)
name: default
current-context: default
contexts:
- context:
cluster: default
namespace: default
user: default
name: default
users:
- name: default
user:
username: admin
password: (paste the admin password here)
Test your config
Create the KUBECONFIG environment variable to reference your config:
export KUBECONFIG=~/config.yml
Test your config
kubectl get node
This should return the list of Kubernetes nodes in your Google Cloud account.
NAME STATUS ROLES AGE VERSION
gke-standard-cluster-1-444 Ready <none> 22m v1.11.8-gke.6
gke-standard-cluster-1-445 Ready <none> 23m v1.11.8-gke.6
gke-standard-cluster-1-446 Ready <none> 23m v1.11.8-gke.6
Create Kubernetes secrets
PM415 deployments have a few different secrets to reference.
kubectl create secret generic mysql --from-literal=password=RADOM_PASSWORD
kubectl create secret generic sendgrid --from-literal=password=YOUR_PASSWORD
kubectl create secret generic appkey --from-literal=password=RANDOM_KEY
Create pods
Edit the file pm415.yaml
and replace the following values with your information. If you do not change the DOMAIN_URL to a valid domain - the installation will fail CORS security rules.
- name: DOMAIN_URL
value: your-domain.com
- name: SENDGRID_USERNAME
value: your-sendgrid-account
Create pods from the PM415 directory
kubectl create -f mysql.yaml
kubectl create -f es.yaml
kubectl create -f pm415.yaml
Check the status of your pods
Check all of your pods to see if any are failing. If you see evictions, you might be running out of resources.
kubectl get pods --all-namespaces
Use the describe command to see specific error messages for a pod
kubectl describe pod pm415-575765d57b-g2pkg
Expose pods as services
This will expose two internal ip's for MySQL and ElasticSearch, and a Load Balancer for PM415.
kubectl create -f mysql-service.yaml
kubectl create -f elastic-search-service.yaml
kubectl create -f pm415-service.yaml
Get IP address and configure DNS
Wait a few minutes and then run this command to get the PM415 load balancer IP address:
kubectl get svc -l app=pm415
This will return information like the following:
pm415 LoadBalancer 10.7.250.50 35.238.238.234 80:31851/TCP 1m
Use this IP address for your DNS A record. Make sure this is the same value as the DOMAIN_URL you set in the pm415.yml
deployment configuration.

Last updated
Was this helpful?