Chef cookbook to create a Kubernetes infrastructure using kubeadm tool:
- Single node cluster.
- Multi node cluster.
Based in the official documents: https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/
none
The following platforms are supported and tested with Test Kitchen:
- CentOS 7+
- RedHat 7+
- Chef 12.1+
- default['kubeadm']['token'] = '1fca99.fcdf6621ba31d922'
- default['kubeadm']['pod_cidr'] = '10.244.0.0/16'
- default['kubeadm']['service_cidr'] = '10.96.0.0/12'
- default['kubeadm']['dns_domain'] = 'cluster.local'
- default['kubeadm']['single_node_cluster'] = false
- default['kubeadm']['flannel_iface'] = 'eth1'
- default['kubeadm']['version'] = '1.8.3-0'
- default['kubeadm']['dashboard_commit_hash7'] = '28527b0'
- default['kubeadm']['heapster_commit_hash7'] = '9f415d0'
- kubelet
- kube-controller-manager (container)
- kube-scheduler (container)
- kube-apiserver (container)
- etcd (container)
- kube-dns (container)
- kube-proxy (container)
- kube-flannel (container)
- docker
Use the runlist: recipe[kubeadm::master], recipe[kubeadm::dashboard], recipe[kubeadm::heapster]
- kube-flannel (container)
- kube-proxy (container)
- docker
Use the runlist: recipe[kubeadm::node]
- dashboard, use recipe[kubeadm::dashboard]
- heapster/influxdb/grafana, use recipe[kubeadm::heapster]
The file .kitchen.yml is provided with the next servers:
- One master node
- Two worker nodes
- Find the secret name for kubernetes-dashboard
$ kubectl -n kube-system get secret | grep kubernetes-dashboard-token
- Get the token needed to login to dashboard. 7bwww is a string found using the previous command.
$ kubectl -n kube-system describe secret kubernetes-dashboard-token-7bwww
- Use kubectl command to create a proxy
$ kubectl proxy
- Access dashboard using a local browser http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
While using Vagrant, is recommended that you install Landrush plugin to create a local DNS server, and avoid having to do a manual configuration of the file /etc/hosts in each server. Check https://github.com/vagrant-landrush/landrush
Be sure to have the next gem installed: kitchen-nodes. You can do the manual installation using:
$ chef exec gem install kitchen-nodes
- Add a private network with static IP. See .kitchen.yml file for an example.