...
This will set up a Kubernetes cluster running locally on your VM.
Deploy a Kubernetes Cluster
Starting a Single-Node (Local Development) Cluster
Provided in the source code for NDS Labs is a script called kube-up.sh which will launch a local kubernetes cluster on your machine.
It will also download kubectl for you, as described above, and place it into the ~/bin/ folder.
Code Block | ||
---|---|---|
| ||
#!/bin/sh
docker run \
--volume=/:/rootfs:ro \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:rw \
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
--volume=/var/run:/var/run:rw \
--volume=`pwd`/manifests/etcd.json:/etc/kubernetes/manifests/etcd.json \
--net=host \
--pid=host \
--privileged=true \
-d \
gcr.io/google_containers/hyperkube-amd64:v{K8S_VERSION} \
/hyperkube kubelet \
--containerized \
--hostname-override="127.0.0.1" \
--address="0.0.0.0" \
--api-servers=http://localhost:8080 \
--config=/etc/kubernetes/manifests \
--allow-privileged=true --v=2
mkdir -p ~/bin
if [ ! -e ~/bin/kubectl ]; then
curl http://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl -o ~/bin/kubectl
chmod +x ~/bin/kubectl
fi |
NOTE: The first time you start your cluster, Kubernetes will tell docker to download several images.
This happens in the background and can take several minutes, so please be patient.
Downloading kubectl
The following set of commands can be used to install kubectl on your machine. You may need to change the version number below:
export K8S_VERSION=1.1.7
mkdir ~/bin
curl -L "https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl" > .
export PATH=$PATH:`pwd`
chmod +x ~/bin/*
Deploying a Multi-Node (Production) Cluster
OpenStack (Nebula)
More information is needed on what would be involved in this process
kubectl create / delete
Pods
A Kubernetes Pod consists of one or more Docker containers running on the same local network.
This allows related or tightly-coupled services to run together with ease, communicating via localhost.
The Kubernetes Pod Spec
Pods can be configured to run with any number of custom configuration options, such as:
...
See http://kubernetes.io/docs/user-guide/pods/multi-container/#the-spec-schema for more details on the Kubernetes spec.
Replication Controllers
Pods are mortal, and can crash when things go wrong.
...
This is immensely powerful in keeping production system running long-term.
Services
A Kubernetes Service allows a set of pods to receive traffic from within the cluster, which is accomplished by sharing the IPs and Ports of the services is through injected environment variables:
...
You can then reference these environment variable in the RC / Pod spec to use the injected values.
NodePort
Setting up a service with a NodePort will allow the service to receive traffic through the node's public (external) IP as well.
The alternative to NodePort is using a LoadBalancer, which is not yet supported on OpenStack.
Labels and Selectors
You can choose which pods a service affects by applying labels to the Pod(s) in question.
...