Skip to content

Commit bdc7ade

Browse files
invidianDongsu Park
andcommitted
templates: add Flatcar Container Linux template
Co-authored-by: Dongsu Park <[email protected]> Signed-off-by: Mateusz Gozdek <[email protected]>
1 parent a37ebbe commit bdc7ade

File tree

1 file changed

+163
-0
lines changed

1 file changed

+163
-0
lines changed
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: Cluster
4+
metadata:
5+
name: "${CLUSTER_NAME}"
6+
spec:
7+
clusterNetwork:
8+
pods:
9+
cidrBlocks: ["192.168.0.0/16"]
10+
infrastructureRef:
11+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
12+
kind: AWSCluster
13+
name: "${CLUSTER_NAME}"
14+
controlPlaneRef:
15+
kind: KubeadmControlPlane
16+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
17+
name: "${CLUSTER_NAME}-control-plane"
18+
---
19+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
20+
kind: AWSCluster
21+
metadata:
22+
name: "${CLUSTER_NAME}"
23+
spec:
24+
region: "${AWS_REGION}"
25+
sshKeyName: "${AWS_SSH_KEY_NAME}"
26+
s3Bucket:
27+
controlPlaneIAMInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io
28+
name: "${AWS_S3_BUCKET_NAME}"
29+
nodesIAMInstanceProfiles:
30+
- nodes.cluster-api-provider-aws.sigs.k8s.io
31+
---
32+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
33+
kind: KubeadmControlPlane
34+
metadata:
35+
name: ${CLUSTER_NAME}-control-plane
36+
spec:
37+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
38+
machineTemplate:
39+
infrastructureRef:
40+
kind: AWSMachineTemplate
41+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
42+
name: "${CLUSTER_NAME}-control-plane"
43+
kubeadmConfigSpec:
44+
initConfiguration:
45+
nodeRegistration:
46+
name: $${COREOS_EC2_HOSTNAME}
47+
kubeletExtraArgs:
48+
cloud-provider: aws
49+
clusterConfiguration:
50+
apiServer:
51+
extraArgs:
52+
cloud-provider: aws
53+
controllerManager:
54+
extraArgs:
55+
cloud-provider: aws
56+
joinConfiguration:
57+
nodeRegistration:
58+
name: $${COREOS_EC2_HOSTNAME}
59+
kubeletExtraArgs:
60+
cloud-provider: aws
61+
format: ignition
62+
ignition:
63+
containerLinuxConfig:
64+
additionalConfig: |
65+
systemd:
66+
units:
67+
- name: kubeadm.service
68+
enabled: true
69+
dropins:
70+
- name: 10-flatcar.conf
71+
contents: |
72+
[Unit]
73+
# kubeadm must run after coreos-metadata populated /run/metadata directory.
74+
Requires=coreos-metadata.service
75+
After=coreos-metadata.service
76+
[Service]
77+
# To make metadata environment variables available for pre-kubeadm commands.
78+
EnvironmentFile=/run/metadata/*
79+
preKubeadmCommands:
80+
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
81+
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml
82+
version: ${KUBERNETES_VERSION}
83+
---
84+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
85+
kind: AWSMachineTemplate
86+
metadata:
87+
name: ${CLUSTER_NAME}-control-plane
88+
spec:
89+
template:
90+
spec:
91+
instanceType: ${AWS_CONTROL_PLANE_MACHINE_TYPE}
92+
iamInstanceProfile: control-plane.cluster-api-provider-aws.sigs.k8s.io
93+
imageLookupBaseOS: flatcar-stable
94+
sshKeyName: ${AWS_SSH_KEY_NAME}
95+
---
96+
apiVersion: cluster.x-k8s.io/v1beta1
97+
kind: MachineDeployment
98+
metadata:
99+
name: ${CLUSTER_NAME}-md-0
100+
spec:
101+
clusterName: ${CLUSTER_NAME}
102+
replicas: ${WORKER_MACHINE_COUNT}
103+
selector:
104+
matchLabels:
105+
template:
106+
spec:
107+
clusterName: ${CLUSTER_NAME}
108+
version: ${KUBERNETES_VERSION}
109+
bootstrap:
110+
configRef:
111+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
112+
kind: KubeadmConfigTemplate
113+
name: ${CLUSTER_NAME}-md-0
114+
infrastructureRef:
115+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
116+
kind: AWSMachineTemplate
117+
name: ${CLUSTER_NAME}-md-0
118+
---
119+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
120+
kind: AWSMachineTemplate
121+
metadata:
122+
name: ${CLUSTER_NAME}-md-0
123+
spec:
124+
template:
125+
spec:
126+
instanceType: ${AWS_NODE_MACHINE_TYPE}
127+
iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io
128+
imageLookupBaseOS: flatcar-stable
129+
sshKeyName: ${AWS_SSH_KEY_NAME}
130+
---
131+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
132+
kind: KubeadmConfigTemplate
133+
metadata:
134+
name: ${CLUSTER_NAME}-md-0
135+
spec:
136+
template:
137+
spec:
138+
joinConfiguration:
139+
nodeRegistration:
140+
kubeletExtraArgs:
141+
cloud-provider: aws
142+
name: $${COREOS_EC2_HOSTNAME}
143+
format: ignition
144+
ignition:
145+
containerLinuxConfig:
146+
additionalConfig: |
147+
systemd:
148+
units:
149+
- name: kubeadm.service
150+
enabled: true
151+
dropins:
152+
- name: 10-flatcar.conf
153+
contents: |
154+
[Unit]
155+
# kubeadm must run after coreos-metadata populated /run/metadata directory.
156+
Requires=coreos-metadata.service
157+
After=coreos-metadata.service
158+
[Service]
159+
# To make metadata environment variables available for pre-kubeadm commands.
160+
EnvironmentFile=/run/metadata/*
161+
preKubeadmCommands:
162+
- envsubst < /etc/kubeadm.yml > /etc/kubeadm.yml.tmp
163+
- mv /etc/kubeadm.yml.tmp /etc/kubeadm.yml

0 commit comments

Comments
 (0)