- You need an Azure account. Visit http://azure.microsoft.com/ to get started.
- Install and configure the Azure cross-platform command-line interface. http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/
- Make sure you have a default account set in the Azure cli, using
azure account set
- Be running a Linux or Mac OS X.
- Get or build a binary release
- If you want to build your own release, you need to have Docker installed. On Mac OS X you can use boot2docker.
The cluster setup scripts can setup Kubernetes for multiple targets. First modify cluster/kube-env.sh
to specify azure:
KUBERNETES_PROVIDER="azure"
Next, specify an existing virtual network in cluster/azure/config-defualt.sh
:
AZ_VNET=<vnet name>
Now you're ready.
You can then use the cluster/kube-*.sh
scripts to manage your azure cluster, start with:
cluster/kube-up.sh
The script above will start (by default) a single master VM along with 4 worker VMs. You
can tweak some of these parameters by editing cluster/azure/config-default.sh
.
Once you have your instances up and running, the hack/build-go.sh
script sets up
your Go workspace and builds the Go components.
The kubectl.sh
line below spins up two containers running
Nginx running on port 80:
cluster/kubectl.sh run-container my-nginx --image=dockerfile/nginx --replicas=2 --port=80
To stop the containers:
cluster/kubectl.sh stop rc my-nginx
To delete the containers:
cluster/kubectl.sh delete rc my-nginx
You can create a pod like this:
cd kubernetes
cluster/kubectl.sh create -f docs/getting-started-guides/pod.json
Where pod.json contains something like:
{
"id": "php",
"kind": "Pod",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "php",
"containers": [{
"name": "nginx",
"image": "dockerfile/nginx",
"ports": [{
"containerPort": 80,
"hostPort": 8080
}],
"livenessProbe": {
"enabled": true,
"type": "http",
"initialDelaySeconds": 30,
"httpGet": {
"path": "/index.html",
"port": 8080
}
}
}]
}
},
"labels": {
"name": "foo"
}
}
You can see your cluster's pods:
cluster/kubectl.sh get pods
and delete the pod you just created:
cluster/kubectl.sh delete pods php
Look in api/examples/
for more examples
cluster/kube-down.sh