From 0543e3011817211445da32afe1eaa60ded44c673 Mon Sep 17 00:00:00 2001 From: David Runge Date: Wed, 16 Dec 2020 21:24:26 +0100 Subject: Add kubernetes example using libvirt provider k8s_cluster/*: Add a terraform-provider-libvirt based examples to semi-automatically create a k8s cluster for testing. --- k8s_cluster/k8s/controller0.yml | 76 +++++++++++++++++++++++++++++++++++++++++ k8s_cluster/k8s/controller1.yml | 28 +++++++++++++++ k8s_cluster/k8s/worker0.yml | 19 +++++++++++ k8s_cluster/k8s/worker1.yml | 19 +++++++++++ 4 files changed, 142 insertions(+) create mode 100644 k8s_cluster/k8s/controller0.yml create mode 100644 k8s_cluster/k8s/controller1.yml create mode 100644 k8s_cluster/k8s/worker0.yml create mode 100644 k8s_cluster/k8s/worker1.yml (limited to 'k8s_cluster/k8s') diff --git a/k8s_cluster/k8s/controller0.yml b/k8s_cluster/k8s/controller0.yml new file mode 100644 index 0000000..db8a847 --- /dev/null +++ b/k8s_cluster/k8s/controller0.yml @@ -0,0 +1,76 @@ +--- +# https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2#InitConfiguration +apiVersion: kubeadm.k8s.io/v1beta2 +kind: InitConfiguration +bootstrapTokens: + - token: 783bdf.3f89s0fje9f38fhf + description: "kubeadm bootstrap token for controller1" + usages: + - authentication + - signing + groups: + - system:bootstrappers:kubeadm:default-node-token + ttl: 1h + - token: 9a08jv.c0izixklcxtmnze7 + description: "kubeadm bootstrap token for worker0" + usages: + - authentication + - signing + groups: + - system:bootstrappers:kubeadm:default-node-token + ttl: 1h + - token: 783bde.3f89s0fje9f38fhf + description: "kubeadm bootstrap token for worker1" + usages: + - authentication + - signing + groups: + - system:bootstrappers:kubeadm:default-node-token + ttl: 1h +nodeRegistration: + name: controller0 + criSocket: /run/crio/crio.sock + taints: + - key: kubeadmNode + value: master + effect: NoSchedule + kubeletExtraArgs: + cgroup-driver: systemd +localAPIEndpoint: + advertiseAddress: 0.0.0.0 + bindPort: 6443 +certificateKey: e6a2eb8581237ab72a4f494f30285ec12a9694d750b9785706a83bfcbbbd2204 +--- +# https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2#ClusterConfiguration +apiVersion: kubeadm.k8s.io/v1beta2 +kind: ClusterConfiguration +kubernetesVersion: v1.20.0 +controlPlaneEndpoint: k8s:6443 +certificatesDir: /etc/kubernetes/pki +imageRepository: k8s.gcr.io +useHyperKubeImage: false +clusterName: cluster0 +networking: + serviceSubnet: 10.96.0.0/12 + podSubnet: 10.85.0.0/16 + dnsDomain: cluster.local +etcd: +apiServer: + certSANs: + - k8s + - controller0 + extraArgs: + authorization-mode: Node,RBAC + timeoutForControlPlane: 4m0s +controllerManager: +scheduler: +--- +# https://godoc.org/k8s.io/kubelet/config/v1beta1#KubeletConfiguration +apiVersion: kubelet.config.k8s.io/v1beta1 +kind: KubeletConfiguration +cgroupDriver: systemd +--- +# https://godoc.org/k8s.io/kube-proxy/config/v1alpha1#KubeProxyConfiguration +apiVersion: kubeproxy.config.k8s.io/v1alpha1 +kind: KubeProxyConfiguration +clusterCIDR: 10.85.0.0/16 diff --git a/k8s_cluster/k8s/controller1.yml b/k8s_cluster/k8s/controller1.yml new file mode 100644 index 0000000..c99129b --- /dev/null +++ b/k8s_cluster/k8s/controller1.yml @@ -0,0 +1,28 @@ +--- +# https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2#JoinConfiguration +apiVersion: kubeadm.k8s.io/v1beta2 +kind: JoinConfiguration +nodeRegistration: + name: controller1 + criSocket: /run/crio/crio.sock + taints: + - key: kubeadmNode + value: master + effect: NoSchedule + kubeletExtraArgs: + cgroup-driver: systemd +discovery: + bootstrapToken: + token: 783bdf.3f89s0fje9f38fhf + apiServerEndpoint: k8s:6443 + unsafeSkipCAVerification: true +controlPlane: + localAPIEndpoint: + advertiseAddress: 0.0.0.0 + bindPort: 6443 + certificateKey: e6a2eb8581237ab72a4f494f30285ec12a9694d750b9785706a83bfcbbbd2204 +--- +# https://godoc.org/k8s.io/kubelet/config/v1beta1#KubeletConfiguration +apiVersion: kubelet.config.k8s.io/v1beta1 +kind: KubeletConfiguration +cgroupDriver: systemd diff --git a/k8s_cluster/k8s/worker0.yml b/k8s_cluster/k8s/worker0.yml new file mode 100644 index 0000000..dc9ff0e --- /dev/null +++ b/k8s_cluster/k8s/worker0.yml @@ -0,0 +1,19 @@ +--- +# https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2#JoinConfiguration +apiVersion: kubeadm.k8s.io/v1beta2 +kind: JoinConfiguration +nodeRegistration: + name: worker0 + criSocket: /run/crio/crio.sock + kubeletExtraArgs: + cgroup-driver: systemd +discovery: + bootstrapToken: + token: 9a08jv.c0izixklcxtmnze7 + apiServerEndpoint: k8s:6443 + unsafeSkipCAVerification: true +--- +# https://godoc.org/k8s.io/kubelet/config/v1beta1#KubeletConfiguration +apiVersion: kubelet.config.k8s.io/v1beta1 +kind: KubeletConfiguration +cgroupDriver: systemd diff --git a/k8s_cluster/k8s/worker1.yml b/k8s_cluster/k8s/worker1.yml new file mode 100644 index 0000000..8ce8a81 --- /dev/null +++ b/k8s_cluster/k8s/worker1.yml @@ -0,0 +1,19 @@ +--- +# https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2#JoinConfiguration +apiVersion: kubeadm.k8s.io/v1beta2 +kind: JoinConfiguration +nodeRegistration: + name: worker1 + criSocket: /run/crio/crio.sock + kubeletExtraArgs: + cgroup-driver: systemd +discovery: + bootstrapToken: + token: 783bde.3f89s0fje9f38fhf + apiServerEndpoint: k8s:6443 + unsafeSkipCAVerification: true +--- +# https://godoc.org/k8s.io/kubelet/config/v1beta1#KubeletConfiguration +apiVersion: kubelet.config.k8s.io/v1beta1 +kind: KubeletConfiguration +cgroupDriver: systemd -- cgit v1.2.3-70-g09d2