- Provision a control node on GCE
- Configure client SSL tunnels for remote access to etcd and fleet
- Provision 5 Kubernetes nodes on GCE
cd intro-to-kubernetes-workshop/cloud-configs
The control node will be used to bootstrap the k8s cluster. It will also serve as the host for the client applications.
The control node will run the following services:
- etcd
- fleet
- flannel-route-manager
gcloud compute instances create kcontrol \
--image-project coreos-cloud \
--image coreos-alpha-472-0-0-v20141017 \
--boot-disk-size 200GB \
--machine-type g1-small \
--can-ip-forward \
--scopes compute-rw \
--metadata-from-file user-data=kcontrol.yaml \
--zone us-central1-a
gcloud compute instances list
ssh -i ~/.ssh/google_compute_engine -f -nNT -L 4001:127.0.0.1:4001 core@${KCONTROL_EXTERNAL_IP}
export FLEETCTL_TUNNEL="${KCONTROL_EXTERNAL_IP}"
Configure the cluster using the etcdctl command.
The flannel subnet manager requires the following settings in etcd:
etcdctl --no-sync set /coreos.com/network/config '{"Network":"10.244.0.0/16", "Backend":{"Type": "alloc"}}'
The node will run the following services:
- docker
- fleet
- flannel
- kubelet
- proxy
One of the nodes will be elected master by fleet and will run the additional services:
- apiserver
- scheduler
- replication controller
- kube-register
Grab the INTERNAL_IP
for the kcontrol machine
gcloud compute instances list
Edit the knode.yaml and update the following lines:
sed -i "" -e 's/CONTROL-NODE-INTERNAL-IP/${KCONTROL_INTERNAL_IP}/g' knode.yaml
gcloud compute instances create knode1 knode2 knode3 knode4 knode5 \
--image-project coreos-cloud \
--image coreos-alpha-472-0-0-v20141017 \
--boot-disk-size 200GB \
--machine-type g1-small \
--can-ip-forward \
--metadata-from-file user-data=knode.yaml \
--zone us-central1-a
gcloud compute instances list
etcdctl --no-sync ls / -recursive
fleetctl list-machines
Note: if you see an 'unable to authenticate' error when you run fleetctl
, then try first running:
ssh-add ~/.ssh/google_compute_engine
(Substitute the filename of your ssh keys as necessary).
These keys are generated the first time you run gcloud compute ssh
.
Only do this if you need to start over or clean up after you are done.
gcloud compute instances delete knode1 knode2 knode3 knode4 knode5 kcontrol \
--zone us-central1-a --delete-disks all