Skip to content

Instantly share code, notes, and snippets.

@jvandertil
Last active October 5, 2016 09:37
Show Gist options
  • Save jvandertil/c6fc916c8bfad925d9cdda3d7e425bb5 to your computer and use it in GitHub Desktop.
Save jvandertil/c6fc916c8bfad925d9cdda3d7e425bb5 to your computer and use it in GitHub Desktop.
Kubernetes on Azure

NOTE: This does not work properly on newer versions of nodejs, will have a look at creating an up to date version.

If it does not work properly for you try doing this in a Docker container with an older version of node:

docker run node:0.10 /bin/bash

This works properly on Bash on Ubuntu on Windows because Ubuntu 14.04 has quite an old version of Node in the repositories.

sudo apt-get install nodejs-legacy npm

Follow instructions here to get the cluster started, or do the following:

git clone https://github.com/weaveworks-guides/weave-kubernetes-coreos-azure kube-azure
cd kube-azure
npm install

# Login to Azure, follow the instructions.
./azure-login.js

# Create cluster
./create-kubernetes-cluster.js

# Connect to the Kubernetes master
ssh -F ./output/kube_{*}_ssh_conf kube-00

Run a demo image:

kubectl run hellomvc --image=jvandertil/hellomvc --port=5000

Expose the deployment

kubectl expose deployment hellomvc --target-port=5000 --external-ip=$(hostname -i)

Open the port on the Azure service:

# On your local machine
./node_modules/.bin/azure vm endpoint create kube-00 80 5000
./node_modules/.bin/azure vm endpoint show kube-00 tcp-80-5000

To scale the deployed pod run:

# Scaling deployment
kubectl scale --replicas=3 deployment/hellomvc

To stop and destroy the pod and service run:

kubectl delete service hellomvc
kubectl delete deployment hellomvc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment