You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Custom pod network CIDR](#custom-pod-network-cidr)
19
22
20
23
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
21
24
22
-
# Required Configuration
25
+
# Required configuration
23
26
24
-
To successfully run a Kubernetes cluster in OpenStack, you will need to configure a few essential properties. The following configurations are necessary:
25
-
- public network
26
-
- floating ip address
27
-
- at least one of the supported operating system images
28
-
- ssh authorized key
27
+
The cluster configuration file can be generated by using [`clusterctl config cluster`](https://cluster-api.sigs.k8s.io/user/quick-start.html#generating-the-cluster-configuration) command.
28
+
This command actually uses [the template file](../templates/cluster-template.yaml) and replace the values surrounded by `${}` with environment variables. You have to set all required environment variables in advance. The following sections explain some more details about what should be configured.
29
29
30
-
## Cluster Configuration YAML files
30
+
Note: You can use [the template file](../templates/cluster-template.yaml) by manually replacing values.
31
31
32
-
The cluster configuration file can be generated by using [`clusterctl config cluster`](https://cluster-api.sigs.k8s.io/user/quick-start.html#generating-the-cluster-configuration) command or by using one of the template files placed under `/template` directory. The file contain configuration on what OpenStack elements to use to create the cluster on, and which cluster components to create. However the template is incomplete and needs to be filled in. The following sections explain some more details about what can be configured.
32
+
## Operating system image
33
33
34
-
## Public Network
34
+
We currently depend on an up-to-date version of cloud-init otherwise the operating system choice is yours. The kubeadm bootstrap provider we're using also depends on some pre-installed software like a container runtime, kubelet, kubeadm, etc.. . For an examples how to build such an image take a look at [image-builder (openstack)](https://image-builder.sigs.k8s.io/capi/providers/openstack.html).
35
+
36
+
The image can be referenced by exposing it as an environment variable `OPENSTACK_IMAGE_NAME`.
37
+
38
+
## Public network
35
39
36
40
The public network id can be obtained by using command,
37
41
38
42
```bash
39
-
openstack network show <public network name>| grep "\<id\>"
43
+
openstack network list --external
40
44
```
41
45
The ID must be expose as an environment variable `OPENSTACK_EXTERNAL_NETWORK_ID`
42
46
43
47
Note: If your openstack cluster does not already have a public network, you should contact your cloud service provider. We will not review how to troubleshoot this here.
44
48
45
-
## Floating IPs
49
+
## Floating IP
46
50
47
-
You have to be able to at least assign floating IPs in your OpenStack. If you don't have rights
48
-
to create floating IPs you have to make sure they already exist before creating the cluster. You can create one using,
51
+
You have to be able to create a floating IP in your OpenStack. You can create one using,
49
52
50
53
```bash
51
54
openstack floating ip create <public network>
52
55
```
53
56
The IP must be exposed as an environment variable `OPENSTACK_CONTROLPLANE_IP`.
54
57
55
-
## Operating System Images
58
+
Note: Only user with admin role can create a floating IP with specific IP.
56
59
57
-
We currently depend on an update version of cloud-init otherwise the operating system choice is yours. The kubeadm bootstrap provider we're using also depends on some pre-installed software like a controller-runtime, kubelet, kubeadm, etc.. . For an examples how to build such an image take a look at [image-builder (openstack)](https://image-builder.sigs.k8s.io/capi/providers/openstack.html).
60
+
## SSH authorized key
58
61
59
-
The image can be referenced by exposing it as an environment variable `OPENSTACK_IMAGE_NAME`.
62
+
The ssh public key is required. This key does not need to be created by OpenStack key pair.
60
63
61
-
## SSH Authorized Key
64
+
The public key must be exposed as an environment variable `OPENSTACK_SSH_AUTHORIZED_KEY`.
62
65
63
-
Openstack ssh keypair is required for the setup. This can be generated using command,
64
-
65
-
```bash
66
-
openstack keypair create <name>
67
-
```
68
-
The keypair must be exposed as an environment variable `OPENSTACK_SSH_AUTHORIZED_KEY`.
69
-
70
-
If you want to login to each machine by ssh, you have to configure security groups. If `spec.managedSecurityGroups` of `OpenStackCluster` set to true, two security groups will be created. One is `k8s-cluster-${NAMESPACE}-${CLUSTER_NAME}-secgroup-controlplane`, another is `k8s-cluster-${NAMESPACE}-${CLUSTER_NAME}-secgroup-worker`. These security group rules are following kubeadm's [Check required ports](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#check-required-ports) so that each node can not be logged in through ssh by default. Please add existing security group allowing ssh port to `OpenStackMachineTemplate` spec. Here is an example:
66
+
If you want to login to each machine by ssh, you have to configure security groups. If `spec.managedSecurityGroups` of `OpenStackCluster` set to true, two security groups will be created and added to the instances. One is `k8s-cluster-${NAMESPACE}-${CLUSTER_NAME}-secgroup-controlplane`, another is `k8s-cluster-${NAMESPACE}-${CLUSTER_NAME}-secgroup-worker`. These security group rules include the kubeadm's [Check required ports](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#check-required-ports) so that each node can not be logged in through ssh by default. Please add pre-existing security group allowing ssh port to OpenStackMachineTemplate spec. Here is an example:
The [env.rc](./env.rc) script sets the environment variables related to credentials.
83
+
84
+
```bash
85
+
source env.rc <path/to/clouds.yaml> <cloud>
86
+
```
87
+
88
+
The following variables are set.
89
+
90
+
| Variable | Meaning |
91
+
:----- | :--------
92
+
| OPENSTACK_CLOUD | The cloud name which is used as second argument |
93
+
| OPENSTACK_CLOUD_YAML_B64 | The secret used by Cluster API Provider OpenStack accessing OpenStack |
94
+
| OPENSTACK_CLOUD_PROVIDER_CONF_B64 | The content of [cloud.conf](https://kubernetes.io/docs/concepts/cluster-administration/cloud-providers/#cloud-conf) which is used by OpenStack cloud provider |
95
+
| OPENSTACK_CLOUD_CACERT_B64 | (Optional) The content of your custom CA file which can be specified in your clouds.yaml by `ca-file`|
96
+
97
+
## Availability zone
98
+
99
+
The availability zone names must be exposed as an environment variable `OPENSTACK_FAILURE_DOMAIN`.
100
+
101
+
## DNS server
102
+
103
+
The DNS servers must be exposed as an environment variable `OPENSTACK_DNS_NAMESERVERS`.
104
+
105
+
# Optional Configuration
106
+
85
107
## Network Filters
86
108
87
109
If you have a complex query that you want to use to lookup a network, then you can do this by using a network filter. More details about the filter can be found in [NetworkParam](../api/v1alpha3/types.go)
@@ -182,8 +204,6 @@ spec:
182
204
nickname: bobbert
183
205
```
184
206
185
-
# Optional Configuration
186
-
187
207
## Boot From Volume
188
208
189
209
1. For example in `examples/_out/controlplane.yaml` set `spec.rootVolume.diskSize` to something greater than `0` means boot from volume.
@@ -208,5 +228,4 @@ If creating servers in your OpenStack takes a long time, you can increase the ti
208
228
209
229
## Custom pod network CIDR
210
230
211
-
If `192.168.0.0/16` is already in use within your network, you must select a different pod network CIDR. You have to replace the CIDR `192.168.0.0/16` with your own in the generated example files: `addons.yaml`and `cluster.yaml`.
212
-
231
+
If `192.168.0.0/16` is already in use within your network, you must select a different pod network CIDR. You have to replace the CIDR `192.168.0.0/16` with your own in the generated file.
0 commit comments