Skip to content

Commit 26427a5

Browse files
authored
Merge pull request #576 from hidekazuna/update_doc
📖 Update Required Configuration
2 parents 3cc3cab + 1f214c6 commit 26427a5

File tree

1 file changed

+55
-36
lines changed

1 file changed

+55
-36
lines changed

docs/configuration.md

Lines changed: 55 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,68 @@
22
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
33
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
44

5-
- [Required Configuration](#required-configuration)
6-
- [Cluster configuration YAML files](#cluster-configuration-yaml-files)
7-
- [Public Network](#public-network)
8-
- [Floating IPs](#floating-ips)
9-
- [Operating System Images](#operating-system-images)
5+
- [Required configuration](#required-configuration)
6+
- [Operating system image](#operating-system-image)
7+
- [Public network](#public-network)
8+
- [Floating IP](#floating-ip)
9+
- [SSH authorized key](#ssh-authorized-key)
10+
- [OpenStack credential](#openstack-credential)
11+
- [Availability zone](#availability-zone)
12+
- [DNS server](#dns-server)
13+
- [Optional Configuration](#optional-configuration)
1014
- [Network Filters](#network-filters)
1115
- [Multiple Networks](#multiple-networks)
1216
- [Subnet Filters](#subnet-filters)
1317
- [Tagging](#tagging)
1418
- [Metadata](#metadata)
15-
- [Optional Configuration](#optional-configuration)
1619
- [Boot From Volume](#boot-from-volume)
1720
- [Timeout settings](#timeout-settings)
1821
- [Custom pod network CIDR](#custom-pod-network-cidr)
1922

2023
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2124

22-
# Required Configuration
25+
# Required configuration
2326

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.
2929

30-
## Cluster Configuration YAML files
30+
Note: You can use [the template file](../templates/cluster-template.yaml) by manually replacing values.
3131

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
3333

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
3539

3640
The public network id can be obtained by using command,
3741

3842
```bash
39-
openstack network show <public network name> | grep "\<id\>"
43+
openstack network list --external
4044
```
4145
The ID must be expose as an environment variable `OPENSTACK_EXTERNAL_NETWORK_ID`
4246

4347
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.
4448

45-
## Floating IPs
49+
## Floating IP
4650

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,
4952

5053
```bash
5154
openstack floating ip create <public network>
5255
```
5356
The IP must be exposed as an environment variable `OPENSTACK_CONTROLPLANE_IP`.
5457

55-
## Operating System Images
58+
Note: Only user with admin role can create a floating IP with specific IP.
5659

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
5861

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.
6063

61-
## SSH Authorized Key
64+
The public key must be exposed as an environment variable `OPENSTACK_SSH_AUTHORIZED_KEY`.
6265

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:
7167

7268
```yaml
7369
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
@@ -78,10 +74,36 @@ spec:
7874
template:
7975
spec:
8076
securityGroups:
81-
- name: k8s-cluster-${NAMESPACE}-${CLUSTER_NAME}-secgroup-controlplane
8277
- name: allow-ssh
8378
```
8479
80+
## OpenStack credential
81+
82+
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+
85107
## Network Filters
86108

87109
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:
182204
nickname: bobbert
183205
```
184206

185-
# Optional Configuration
186-
187207
## Boot From Volume
188208

189209
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
208228

209229
## Custom pod network CIDR
210230

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

Comments
 (0)