Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
setup update example Sep 3, 2019
.gitignore update example Sep 3, 2019
README.md Add sonobuoy directory Sep 10, 2019
Vagrantfile Adjust Vagrantfile VM parameters Sep 11, 2019
calico.yaml update example Sep 3, 2019
cke-cluster.yml update example Sep 3, 2019
cke-entrypoint.sh update example Sep 3, 2019
cke.config update example Sep 3, 2019
cke.config.yml update example Sep 3, 2019
docker-compose.yml update example Sep 3, 2019
etcd-entrypoint.sh update example Sep 3, 2019
etcd.conf.yml update example Sep 3, 2019
vault-entrypoint.sh update example Sep 3, 2019
vault.hcl update example Sep 3, 2019
wait-up.sh update example Sep 3, 2019

README.md

Demonstration with docker-compose and Vagrant

Overview

This demonstration gets you a three-node Kubernetes cluster installed by CKE.

Be warned that etcd and vault deployed by this example is not durable nor secure. Use this only for testing and development.

Requirements

CKE host

  • git
  • Docker
  • Docker Compose
  • VirtualBox
  • Vagrant

Setup CKE

Follow the steps to setup CKE with docker-compose.

$ git clone https://github.com/cybozu-go/cke.git
$ cd ./cke/example/
$ mkdir bin
$ mkdir etcd-data
$ docker-compose up -d

bin is the directory where the cli tools are installed. etcd-data is the directory where the data of etcd is stored.

You will be able to see that the following containers are running.

$ docker ps
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                                  NAMES
844ea90ab7b5        quay.io/cybozu/cke:1.15    "/entrypoint.sh"         12 seconds ago      Up 10 seconds                                              cke
9617f2dc36c5        quay.io/cybozu/vault:1.1   "/entrypoint.sh"         14 seconds ago      Up 12 seconds       0.0.0.0:8200-8201->8200-8201/tcp       vault
7140fa308dc3        quay.io/cybozu/etcd:3.3    "/entrypoint.sh"         16 seconds ago      Up 14 seconds       0.0.0.0:2379-2380->2379-2380/tcp       etcd

Setup node VMs

In this demonstration, Kubernetes Cluster is deployed on 3 Virtual Machines.

Follow the steps to setup the VMs with Vagrant.

$ vagrant up

After a few minutes you will be able to log in to the VM via ssh.

$ vagrant ssh worker-1

Deploying Kubernetes Cluster

Registering SSH private-key

Register SSH private-key to log in to the VMs.

$ ./bin/ckecli --config=./cke.config vault ssh-privkey ~/.vagrant.d/insecure_private_key

Declare Kubernetes Cluster Configuration

Declares the number of control planes and workers of Kubernetes cluster and configuration.

$ ./bin/ckecli --config=./cke.config constraints set minimum-workers 2
$ ./bin/ckecli --config=./cke.config constraints set control-plane-count 1
$ ./bin/ckecli --config=./cke.config cluster set ./cke-cluster.yml

Checking the logs

Once the cluster configuration is set, CKE will soon install Kubernetes.

You can see the operation history with the following command.

$ ./bin/ckecli --config=./cke.config history -f

You can also see the logs of CKE.

$ docker logs cke -f

CKE will finish installation of Kubernetes components in a few minutes.

Operating Kubernetes cluster

setup kubectl

See Install and Set Up kubectl

Issuing configuration file of kubectl

You can get a configuration file of kubectl to access Kubernetes cluster with the following command.

$ ./bin/ckecli --config=./cke.config kubernetes issue > $HOME/.kube/config

Setup CNI plugin

CKE itself does not install any network plugins. To implement the Kubernetes networking model, you have to install a plugin.

You can deploy calico on Kubernetes cluster with the following command.

$ kubectl apply -f calico.yaml

See Calico Documantation for details.

After a few minutes, Kubernetes cluster will become ready.

$ kubectl get nodes
NAME            STATUS   ROLES    AGE     VERSION
192.168.1.101   Ready    <none>   7h29m   v1.15.3
192.168.1.102   Ready    <none>   7h29m   v1.15.3
192.168.1.103   Ready    <none>   7h29m   v1.15.3
You can’t perform that action at this time.