Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

126 lines (84 sloc) 4.04 KB

Dillinger + Kubernetes

Some tips on how to deploy Dillinger to a Kubernetes cluster....

NOTE: This document assumes you've successfully created a cluster on GCP and you have a GCP account with a project associated with the cluster.


Create the replication controller and the service running Dillinger. These are already in the root of the directory in your dillinger.k8s.production.yml file. Feel free to modify as you see fit.

We use N|Solid as the Node.js runtime as it is the most robust/enterprise-grade Node.js platform.

Head here and follow the steps for using the N|Solid Docker Image with Kubernetes.

First create the deployment file

kubectl create -f dillinger.k8s.production.yml

If you get an error remove the section for secrets and volumeMounts.

Check the status of the pods

kubectl get pods

Get the IP address of your Dillinger app

gcloud compute forwarding-rules list

Should output something like....

$ gcloud compute forwarding-rules list
abcdef   us-central1   104.197.XXX.XXX  TCP         us-xxxx
To update a running cluster...

Say you cloned the latest update. You want this to roll out to your dev environment. Clone the repo then simply run:

kubectl apply -f dillinger.k8s.production.yml

Create Secrets to Expose Plugin Configs

We now want to be able to expose our configs like Dropbox and Github. Instead of using environment variables we'll use the dropbox-config.json (and others) file which contains sensitive information. That's why we use Kubernetes Secrets to protect it.

In the root of the Dillinger project directory, run:

kubectl create secret generic dropbox-config --from-file=configs/dropbox/dropbox-config.json --namespace=dillinger-prod

Should output:

secret "dropbox-config" created

Check to see it was created

kubectl get secrets

Should output something like:

NAME                  TYPE                                  DATA      AGE
dropbox-config        Opaque                                1         1m

You'll need to add the secret and mount it in the virtual filesystem on your pods.s

vim dillinger.k8s.production.yml

Make the changes there and repeat for each plugin.

Here's a shortcut or it's in the file:

kubectl create secret generic dropbox-config --from-file=configs/dropbox/dropbox-config.json --namespace=dillinger-prod
kubectl create secret generic github-config --from-file=configs/github/github-config.json --namespace=dillinger-prod
kubectl create secret generic onedrive-config --from-file=configs/onedrive/onedrive-config.json --namespace=dillinger-prod
kubectl create secret generic googledrive-config --from-file=configs/googledrive/googledrive-config.json --namespace=dillinger-prod
kubectl create secret generic sponsored-config --from-file=configs/sponsored/sponsored-config.json --namespace=dillinger-prod
kubectl create secret generic googleanalytics-config --from-file=configs/googleanalytics/googleanalytics-config.json --namespace=dillinger-prod
kubectl create secret generic medium-config --from-file=configs/medium/medium-config.json --namespace=dillinger-prod

TODO: Add option for environment variables, not hosted files.

Now update your Kubernetes cluster:

kubectl apply -f dillinger.k8s.production.yml

Once it is "updated" (replaced), delete current pods and the replication controller will automatically restart them with the version containing your secrets/configs.

kubectl delete pods --all

Now check it out with the URL of the app and also see it running in the N|Solid console

kubectl get svc nsolid-secure-proxy --namespace=nsolid

Should output:

NAME                  CLUSTER-IP    EXTERNAL-IP     PORT(S)          AGE
nsolid-secure-proxy   104.198.XX.XX   80/TCP,443/TCP   16h
You can’t perform that action at this time.