Skip to content

Commit

Permalink
docs: Kubernetes on Azure with CoreOS and Weave -
Browse files Browse the repository at this point in the history
- improve the wording
- suggest next step
- remove unrelated code
- minor fix to instructions
- checkin empty dir
  • Loading branch information
errordeveloper committed Mar 10, 2015
1 parent a591543 commit c617699
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 138 deletions.
1 change: 1 addition & 0 deletions docs/getting-started-guides/coreos.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ There are multiple guides on running Kubernetes with [CoreOS](http://coreos.com)
* [Multi-node cluster using cloud-config and Weave on Vagrant](https://github.com/errordeveloper/weave-demos/blob/master/poseidon/README.md)
* [Multi-node cluster using cloud-config and Vagrant](https://github.com/pires/kubernetes-vagrant-coreos-cluster/blob/master/README.md)
* [Multi-node cluster with Vagrant and fleet units using a small OS X App](https://github.com/rimusz/coreos-osx-gui-kubernetes-cluster/blob/master/README.md)
* [Resizable multi-node cluster on Azure with Weave](coreos/azure/README.md)
1 change: 0 additions & 1 deletion docs/getting-started-guides/coreos/azure/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules/
output/*
50 changes: 27 additions & 23 deletions docs/getting-started-guides/coreos/azure/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
---
published: false
title: Weaving Kubernetes on Azure
tags: azure, coreos, kubernetes, usecase, guide, redis, php, cloud, provisioning
---
# Kubernetes on Azure with CoreOS and [Weave](http://weave.works)

## Introduction

In this tutorial we will demonstrate how to deploy a Kubernetes cluster to Azure cloud. Weave makes networking of containers simple and secure, in a transparent, yet robust way. The focus of this tutorial is provide an out-of-the-box production-ready implementation with dedicated Kubernetes master and etcd nodes. It will also show how to scale the cluster with ease.
In this guide I will demonstrate how to deploy a Kubernetes cluster to Azure cloud. You will be using CoreOS with Weave, which implements simple and secure networking, in a transparent, yet robust way. The purpose of this guide is to provide an out-of-the-box implementation that can ultimately be taken into production with little change. It will demonstrate how to provision a dedicated Kubernetes master and etcd nodes, and show how to scale the cluster with ease.

## Let's go!
To get started, you need to checkout the code:

To get started, you need to checkout the code:
```
git clone https://github.com/errordeveloper/weave-demos
cd weave-demos/coreos-azure
git clone https://github.com/GoogleCloudPlatform/kubernetes
cd kubernetes/docs/getting-started-guides/coreos/azure/
```

You will need to have [Node.js installed](http://nodejs.org/download/) on you machine. If you have previously used Azure CLI, you should have it already.

You first need to install some of the dependencies with
First, you need to install some of the dependencies with

```
npm install
Expand All @@ -31,9 +27,9 @@ Now, all you need to do is:
./create-kubernetes-cluster.js
```

This script will provision a cluster suitable for production use, where there is a ring of 3 dedicated etcd nodes, Kubernetes master and 2 minions. The `kube-00` VM will be the master, your work loads are only to be deployed on the minion nodes, `kube-01` and `kube-02`. Initially, all VMs are single-core, to ensure a user of the free tier can reproduce it without paying extra. Later we will show how to add more bigger VMs.
This script will provision a cluster suitable for production use, where there is a ring of 3 dedicated etcd nodes, Kubernetes master and 2 minions. The `kube-00` VM will be the master, your work loads are only to be deployed on the minion nodes, `kube-01` and `kube-02`. Initially, all VMs are single-core, to ensure a user of the free tier can reproduce it without paying extra. I will show how to add more bigger VMs later.

![VMs in Azure](https://www.dropbox.com/s/logk4mot2gnlxgn/Screenshot%202015-02-15%2015.54.45.png?dl=1)
![VMs in Azure](initial_cluster.png)

Once the creation of Azure VMs has finished, you should see the following:

Expand Down Expand Up @@ -91,7 +87,7 @@ redis-master 10.2.1.4 master dockerfile/

## Scaling

Two single-core minions are certainly not enough for a production system of today, and, as you can see we have one _unassigned_ pod. Let's resize the cluster by adding a couple of bigger nodes.
Two single-core minions are certainly not enough for a production system of today, and, as you can see, there is one _unassigned_ pod. Let's resize the cluster by adding a couple of bigger nodes.

You will need to open another terminal window on your machine and go to the same working directory (e.g. `~/Workspace/weave-demos/coreos-azure`).

Expand Down Expand Up @@ -127,7 +123,7 @@ kube-03 environment=production Ready
kube-04 environment=production Ready
```

We can see that two more minions joined happily. Let's resize the number of Guestbook instances we have.
You can see that two more minions joined happily. Let's resize the number of Guestbook instances now.

First, double-check how many replication controllers there are:

Expand All @@ -137,22 +133,22 @@ CONTROLLER CONTAINER(S) IMAGE(S) S
frontendController php-redis kubernetes/example-guestbook-php-redis name=frontend 3
redisSlaveController slave brendanburns/redis-slave name=redisslave 2
```
As we have 4 minions, let's resize proportionally:
As there are 4 minions, let's resize proportionally:
```
core@kube-00 ~ $ kubectl resize --replicas=4 rc redisSlaveController
resized
core@kube-00 ~ $ kubectl resize --replicas=4 rc frontendController
resized
```
Check what we have now:
Check what you have now:
```
kubectl get rc
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
frontendController php-redis kubernetes/example-guestbook-php-redis name=frontend 4
redisSlaveController slave brendanburns/redis-slave name=redisslave 4
```

You now will have more instances of front-end Guestbook apps and Redis slaves; and, if we look up all pods labled `name=frontend`, we should see one running on each node.
You now will have more instances of front-end Guestbook apps and Redis slaves; and, if you look up all pods labled `name=frontend`, you should see one running on each node.

```
core@kube-00 ~/guestbook-example $ kubectl get pods -l name=frontend
Expand All @@ -165,18 +161,26 @@ ae59fa80-b679-11e4-b6f6-000d3a20a034 10.2.4.5 php-redis kubernete

## Exposing the app to the outside world

To makes sure the app is working, we should load it in the browser. For accessing the Guesbook service from the outside world, I had to create an Azure endpoint like shown on the picture below.
To makes sure the app is working, you probably want to load it in the browser. For accessing the Guesbook service from the outside world, an Azure endpoint needs to be created like shown on the picture below.

![Creating an endpoint](external_access.png)

You then should be able to access it from anywhere via the Azure virtual IP for `kube-01`, i.e. `http://104.40.211.194:8000/` as per screenshot.

## Next steps

You now have a full-blow cluster running in Azure, congrats!

![VMs in Azure](https://www.dropbox.com/s/a7gglyamb9pltqn/Screenshot%202015-02-15%2016.02.32.png?dl=1)
You should probably try deploy other [example apps](https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples) or write your own ;)

I was then able to access it from anywhere via the Azure virtual IP for `kube-01`, i.e. `http://104.40.211.194:8000/`.
## Tear down...

## Destructing the VMs
If you don't wish care about the Azure bill, you can tear down the cluster. It's easy to redeploy it, as you can see.

To delete the cluster run this:
```
./destroy-cluster.js ./output/kubernetes_8f984af944f572_deployment.yml
```

Make sure to use the latest state file, as after resizing there is a new one. By the way, with the scripts shown, you can deploy multiple clusters, if you like :)
> Note: make sure to use the _latest state file_, as after resizing there is a new one.
By the way, with the scripts shown, you can deploy multiple clusters, if you like :)

This file was deleted.

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

1 change: 1 addition & 0 deletions docs/getting-started-guides/coreos/azure/output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*

0 comments on commit c617699

Please sign in to comment.