This assumes you've got access to a kubernetes cluster. We have a guide on how we do this at Student Robotics.
To host the official reverse-proxy, we use DigitalOcean. To access the
kubernetes cluster, you need to have access to our DigitalOcean account. To
setup your kubectl
for the following steps, you need to do the following:
-
Log into DigitalOcean, and into the StudentRobotics project.
-
Go to API > Generate New Token
-
Download doctl
-
Log into doctl and, when prompted, enter your access token.
doctl auth init
-
Pick a cluster you want to log into.
doctl k8s cluster list
-
Set your kubectl context to the digitalocean cluster
doctl k8s cluster kubeconfig save $CLUSTER_NAME
This should make your
kubectl
command point to the right place.
To deploy your application to the cluster, and expose it on the host
container under port 30000
, you need to provision it on kubernetes.
kubectl create -f kubernetes/
Because we don't do any sophisticated tagging, we have to force Kubernetes to pull the latest version of the app. We do this by doing the following:
kubectl patch deployment reverse-proxy \
-p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"
If you've changed any of the kubernetes configuration, you need to also deploy to kubernetes.
kubectl apply -f kubernetes/