cookbook 'kube_cluster', '~> 0.2.0'
kube_cluster (2) Versions 0.2.0 Follow0
Installs/Configures kubernetes cluster
cookbook 'kube_cluster', '~> 0.2.0', :supermarket
knife supermarket install kube_cluster
knife supermarket download kube_cluster
chef-kube_cluster
This will be used to initialize a kubernetes cluster
reference: https://www.tecmint.com/install-kubernetes-cluster-on-centos-7/
Steps
- initialize chef cookbook
- chef generate cookbook
<cookbook name>
- chef generate cookbook
- Create Recipes
- Create policies
- Kitchen test(dokken)
- Write actions file to upload to supermarket
Create Recipes
- Disable Selinux ==> might be in gcp's startup script or selinux cookbook(test if restart is needed)** test if works without reboot
- Set Firewall rules on port
- Different for master and worker nodes
-
https://supermarket.chef.io/cookbooks/firewall
firewall-cmd --permanent --add-port=6443/tcp firewall-cmd --permanent --add-port=2379-2380/tcp firewall-cmd --permanent --add-port=10250/tcp firewall-cmd --permanent --add-port=10251/tcp firewall-cmd --permanent --add-port=10252/tcp firewall-cmd --permanent --add-port=10255/tcp firewall-cmd –reload modprobe br_netfilter echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables
- Setup kubernetes yum pkg repo: template file
- Install packages kubeadm,docker
- enable and start the following services
- kubelet
- docker
- Disable swap :
swapoff -a
- initialize kubernetes master:
kubeadm init
- Start cluster as root
- Setup pod network using weavenet- pod network??
- Copy the adm join: try storing token and sha256 in gcp secret store manager - todo once looking if it's possible
Policies
We will need two policies one for master node and another for worker node
kitchen tests
- status of docker kubelet servcies
-test if the number of lines with
NotReady
is zero or not using grep??. Op of kubelet get nodes.
actions
- [x] Add chef_pem key to secrets.
- [x] create a folder with knife config.rb
- [x] apply knife cookbook upload - to upload cookbook to supermarket
- [x] Create and push policies to chef server
Dependent cookbooks
selinux >= 0.0.0 |
firewall >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
0.2.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.2.0 failed this metric
FC067: Ensure at least one platform supported in metadata: kube_cluster/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.2.0 failed this metric
FC067: Ensure at least one platform supported in metadata: kube_cluster/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.2.0 passed this metric
Testing File Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.2.0 failed this metric
0.2.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number