Update docker base template (CAPD)

- update cluster, controlplane and workers
  template
- update includes removing machine
  health check crd
- update pod and service cidr
- remove cni application as post kubeadm command

Relates-To: #452
Change-Id: I04f0a3ed0966cdb6a58d618e50381b45b80f1f10
This commit is contained in:
Rishabh Kumar Jain 2021-01-25 11:13:34 -08:00
parent 63a5d1146c
commit ffe763b96a
3 changed files with 27 additions and 54 deletions

View File

@ -1,26 +1,29 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
kind: DockerCluster
metadata:
name: "target-cluster"
--- ---
apiVersion: cluster.x-k8s.io/v1alpha3 apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster kind: Cluster
metadata: metadata:
name: "target-cluster" name: "target-cluster"
namespace: default
spec: spec:
clusterNetwork: clusterNetwork:
pods:
cidrBlocks:
- 172.17.0.0/16
serviceDomain: cluster.local
services: services:
cidrBlocks: cidrBlocks: ["10.128.0.0/12"]
- 10.0.0.0/24 pods:
cidrBlocks: ["192.168.0.0/16"]
serviceDomain: "cluster.local"
infrastructureRef: infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
kind: DockerCluster kind: DockerCluster
name: "target-cluster" name: "target-cluster"
namespace: default
controlPlaneRef: controlPlaneRef:
kind: KubeadmControlPlane kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 apiVersion: controlplane.cluster.x-k8s.io/v1alpha3
name: "target-cluster-control-plane" name: "target-cluster-control-plane"
namespace: default
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
kind: DockerCluster
metadata:
name: "target-cluster"
namespace: default

View File

@ -3,6 +3,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
kind: DockerMachineTemplate kind: DockerMachineTemplate
metadata: metadata:
name: "target-cluster-control-plane" name: "target-cluster-control-plane"
namespace: default
spec: spec:
template: template:
spec: spec:
@ -14,53 +15,26 @@ kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 apiVersion: controlplane.cluster.x-k8s.io/v1alpha3
metadata: metadata:
name: "target-cluster-control-plane" name: "target-cluster-control-plane"
namespace: default
spec: spec:
replicas: ${ CONTROL_PLANE_MACHINE_COUNT } replicas: ${ CONTROL_PLANE_MACHINE_COUNT }
infrastructureTemplate: infrastructureTemplate:
kind: DockerMachineTemplate kind: DockerMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
name: "target-cluster-control-plane" name: "target-cluster-control-plane"
namespace: default
kubeadmConfigSpec: kubeadmConfigSpec:
clusterConfiguration: clusterConfiguration:
apiServer:
certSANs:
- localhost
- 127.0.0.1
controllerManager: controllerManager:
extraArgs: extraArgs: {enable-hostpath-provisioner: 'true'}
enable-hostpath-provisioner: "true" apiServer:
files: certSANs: [localhost, 127.0.0.1]
- path: /calico.sh
owner: root:root
permissions: "0755"
content: |
#!/bin/sh -x
su - root -c "sleep 10; kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://docs.projectcalico.org/v3.12/manifests/calico.yaml"
initConfiguration: initConfiguration:
nodeRegistration: nodeRegistration:
criSocket: /var/run/containerd/containerd.sock criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs: kubeletExtraArgs: {eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'}
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
joinConfiguration: joinConfiguration:
nodeRegistration: nodeRegistration:
criSocket: /var/run/containerd/containerd.sock criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs: kubeletExtraArgs: {eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'}
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
postKubeadmCommands:
- sh /calico.sh
version: "v1.18.6" version: "v1.18.6"
---
apiVersion: cluster.x-k8s.io/v1alpha3
kind: MachineHealthCheck
metadata:
name: "target-cluster-mhc-0"
spec:
clusterName: "target-cluster"
maxUnhealthy: 100%
selector:
matchLabels:
nodepool: "pool1"
unhealthyConditions:
- type: E2ENodeUnhealthy
status: "True"
timeout: 30s

View File

@ -1,25 +1,22 @@
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
kind: DockerMachineTemplate kind: DockerMachineTemplate
metadata: metadata:
name: "target-cluster-md-0" name: "target-cluster-md-0"
namespace: default
spec: spec:
template: template:
spec: spec: {}
extraMounts:
- containerPath: "/var/run/docker.sock"
hostPath: "/var/run/docker.sock"
--- ---
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
kind: KubeadmConfigTemplate kind: KubeadmConfigTemplate
metadata: metadata:
name: "target-cluster-md-0" name: "target-cluster-md-0"
namespace: default
spec: spec:
template: template:
spec: spec:
joinConfiguration: joinConfiguration:
nodeRegistration: nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs: {eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'} kubeletExtraArgs: {eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'}
--- ---
apiVersion: cluster.x-k8s.io/v1alpha3 apiVersion: cluster.x-k8s.io/v1alpha3
@ -32,18 +29,17 @@ spec:
selector: selector:
matchLabels: matchLabels:
template: template:
metadata:
labels:
"nodepool": "pool1"
spec: spec:
clusterName: "target-cluster" clusterName: "target-cluster"
version: "v1.18.6" version: "v1.18.6"
bootstrap: bootstrap:
configRef: configRef:
name: "target-cluster-md-0" name: "target-cluster-md-0"
namespace: default
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
kind: KubeadmConfigTemplate kind: KubeadmConfigTemplate
infrastructureRef: infrastructureRef:
name: "target-cluster-md-0" name: "target-cluster-md-0"
namespace: default
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
kind: DockerMachineTemplate kind: DockerMachineTemplate