Skip to content

Commit 4466fee

Browse files
committed
added openstack cluster example
Signed-off-by: Stefano Cenizzi <[email protected]>
1 parent 79e01d0 commit 4466fee

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: ${NAMESPACE}
5+
---
6+
apiVersion: v1
7+
data:
8+
cacert: ""
9+
clouds.yaml: ""
10+
kind: Secret
11+
metadata:
12+
labels:
13+
clusterctl.cluster.x-k8s.io/move: "true"
14+
name: ${CLUSTER_NAME}-cloud-config
15+
namespace: ${CLUSTER_NAME}
16+
---
17+
apiVersion: cluster.x-k8s.io/v1beta1
18+
kind: Cluster
19+
metadata:
20+
name: ${CLUSTER_NAME}
21+
namespace: ${NAMESPACE}
22+
labels:
23+
clusterName: ${CLUSTER_NAME}
24+
spec:
25+
clusterNetwork:
26+
pods:
27+
cidrBlocks:
28+
- 192.168.0.0/16
29+
serviceDomain: cluster.local
30+
controlPlaneRef:
31+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
32+
kind: RKE2ControlPlane
33+
name: ${CLUSTER_NAME}-control-plane
34+
infrastructureRef:
35+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
36+
kind: OpenStackCluster
37+
name: ${CLUSTER_NAME}
38+
---
39+
apiVersion: cluster.x-k8s.io/v1beta1
40+
kind: MachineDeployment
41+
metadata:
42+
name: ${CLUSTER_NAME}-workers
43+
namespace: ${NAMESPACE}
44+
labels:
45+
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
46+
spec:
47+
clusterName: ${CLUSTER_NAME}
48+
replicas: 3
49+
selector:
50+
matchLabels:
51+
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
52+
template:
53+
metadata:
54+
labels:
55+
cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME}
56+
spec:
57+
bootstrap:
58+
configRef:
59+
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
60+
kind: RKE2ConfigTemplate
61+
name: ${CLUSTER_NAME}-workers
62+
clusterName: ${CLUSTER_NAME}
63+
failureDomain: ${OPENSTACK_FAILURE_DOMAIN}
64+
infrastructureRef:
65+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
66+
kind: OpenStackMachineTemplate
67+
name: ${CLUSTER_NAME}-workers
68+
version: v1.30.8+rke2r1
69+
---
70+
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
71+
kind: RKE2ControlPlane
72+
metadata:
73+
name: ${CLUSTER_NAME}-control-plane
74+
namespace: ${NAMESPACE}
75+
spec:
76+
agentConfig:
77+
kubelet:
78+
extraArgs:
79+
- provider-id=openstack:///{{ ds.meta_data.uuid }}
80+
nodeName: '{{ ds.meta_data.local_hostname }}'
81+
version: v1.30.8+rke2r1
82+
infrastructureRef:
83+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
84+
kind: OpenStackMachineTemplate
85+
name: ${CLUSTER_NAME}-control-plane
86+
replicas: 3
87+
rolloutStrategy:
88+
type: "RollingUpdate"
89+
rollingUpdate:
90+
maxSurge: 0
91+
registrationMethod: "internal-first"
92+
serverConfig:
93+
cni: calico
94+
disableComponents:
95+
pluginComponents:
96+
- "rke2-ingress-nginx" #if not needed
97+
kubernetesComponents:
98+
- cloudController #Use openstack-cloud-controller-manager
99+
etcd:
100+
backupConfig:
101+
s3:
102+
endpoint: ${S3_ENDPOINT}
103+
s3CredentialSecret:
104+
apiVersion: v1
105+
kind: Secret
106+
name: etcd-backup-secret
107+
namespace: ${NAMESPACE}
108+
region: ${S3_REGION}
109+
bucket: ${S3_BUCKET}
110+
---
111+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
112+
kind: OpenStackCluster
113+
metadata:
114+
name: ${CLUSTER_NAME}
115+
namespace: ${NAMESPACE}
116+
spec:
117+
apiServerLoadBalancer:
118+
enabled: true
119+
cloudName: ${OPENSTACK_CLOUD_NAME}
120+
dnsNameservers:
121+
- 1.1.1.1
122+
- 8.8.8.8
123+
externalNetworkId: ${OPENSTACK_PUBLIC_NETWORK_ID}
124+
identityRef:
125+
kind: Secret
126+
name: ${CLUSTER_NAME}-cloud-config
127+
managedSecurityGroups: true
128+
nodeCidr: 10.65.0.0/24
129+
---
130+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
131+
kind: OpenStackMachineTemplate
132+
metadata:
133+
name: ${CLUSTER_NAME}-control-plane
134+
namespace: ${NAMESPACE}
135+
spec:
136+
template:
137+
spec:
138+
cloudName: ${OPENSTACK_CLOUD_NAME}
139+
securityGroups: #Example of pre-created security groups
140+
- name: Cilium
141+
- name: rke2
142+
flavor: ${OPENSTACK_CONTROLPLANE_FLAVOR}
143+
identityRef:
144+
kind: Secret
145+
name: ${CLUSTER_NAME}-cloud-config
146+
image: ${IMAGE}
147+
sshKeyName: ${OPENSTACK_SSH_KEY}
148+
rootVolume:
149+
availabilityZone: nova
150+
diskSize: 20
151+
volumeType: default
152+
---
153+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
154+
kind: OpenStackMachineTemplate
155+
metadata:
156+
name: ${CLUSTER_NAME}-workers
157+
namespace: ${NAMESPACE}
158+
spec:
159+
template:
160+
spec:
161+
cloudName: ${OPENSTACK_CLOUD_NAME}
162+
flavor: ${OPENSTACK_WORKER_FLAVOR}
163+
identityRef:
164+
kind: Secret
165+
name: ${CLUSTER_NAME}-cloud-config
166+
image: ${IMAGE}
167+
sshKeyName: ${OPENSTACK_SSH_KEY}
168+
securityGroups: #Example of pre-created security groups
169+
- name: Cilium
170+
- name: rke2
171+
rootVolume:
172+
availabilityZone: nova
173+
diskSize: 50
174+
volumeType: ${OPENSTACK_VOLUME_PROVIDER}

0 commit comments

Comments
 (0)