Skip to content

Commit bd97913

Browse files
authored
docs: clarify k0sConfig as a ClusterConfig resource (#955)
Signed-off-by: Adrian Pedriza <[email protected]>
1 parent a49587d commit bd97913

File tree

1 file changed

+71
-10
lines changed

1 file changed

+71
-10
lines changed

docs/configuration.md

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,78 @@ The type of persistence used for this can be configurable via `spec.persistence`
3131

3232
## K0s configuration
3333

34-
K0smotron allows you to configure k0s via `spec.k0sConfig` field. If empty, the default configuration will be used.
34+
K0smotron allows you to configure k0s via `spec.k0sConfig` field. This field expects a k0s **ClusterConfig** resource as value, which defines the configuration parameters for k0s. If `spec.k0sConfig` is left empty, the default k0s configuration will be applied.
3535

36-
Refer to [k0s docs](https://docs.k0sproject.io/stable/configuration/) for a reference on k0s configuration.
36+
Refer to [k0s docs](https://docs.k0sproject.io/stable/configuration/) for a reference on configuring k0s via the ClusterConfig resource.
3737

38-
**Note**: Some fields will be overwritten by k0smotron. K0smotron will set the following fields:
39-
40-
- `spec.k0sConfig.spec.api.externalAddress` will be set to the value of `spec.externalAddress` if `spec.externalAddress` is set.
41-
If not, k0smotron will use load balancer IP or try to detect `externalAddress` out of nodes IP addresses.
42-
- `spec.k0sConfig.spec.api.port` will be set to the value of `spec.service.apiPort`.
43-
- `spec.k0sConfig.spec.konnectivity.port` will be set to the value of `spec.service.konnectivityPort`.
44-
- `spec.k0sConfig.spec.storage.kine.dataSource` will be set to the value of `spec.kineDataSourceURL` if `spec.kineDataSourceURL` is set.
45-
`spec.k0sConfig.spec.storage.type` will be set to `kine`.
38+
### ClusterConfig for K0smotron
4639

40+
K0smotron can automatically generate `spec.k0sConfig` or override some fields (if provided) based on the values provided for the [Cluster](resource-reference.md/#clusterspec) resource, following specific configuration rules:
4741

42+
<table>
43+
<tr>
44+
<th style="width: 30%;">ClusterConfig Field</th>
45+
<th style="width: 30%;">Value</th>
46+
<th>Condition</th>
47+
</tr>
48+
<tr>
49+
<td><code>api.externalAddress</code></td>
50+
<td>Value in <code>spec.externalAddress</code> if provided. Otherwise, depending of the service type, K0smotron attempts to detect an external address from the load balancer or available node IPs.</td>
51+
<td>Only set if <code>nodeLocalLoadBalancing.enabled</code> is <code>false</code>.</td>
52+
</tr>
53+
<tr>
54+
<td><code>api.port</code></td>
55+
<td>Value in <code>spec.service.apiPort</code></td>
56+
<td>Always.</td>
57+
</tr>
58+
<tr>
59+
<td><code>api.sans</code></td>
60+
<td><code>[&lt;spec.externalAddress&gt;, &lt;cluster-svc-ips&gt;, &lt;cluster-service-name&gt;, &lt;cluster-service-name-namespaced&gt;, &lt;cluster-service-name-DNS&gt;], &lt;cluster-service-name-FQDNS&gt;</code> plus the possible provided ones.</td>
61+
<td>Always.</td>
62+
</tr>
63+
<tr>
64+
<td><code>konnectivity.port</code></td>
65+
<td>Value in <code>spec.service.konnectivityPort</code></td>
66+
<td>Always.</td>
67+
</tr>
68+
<tr>
69+
<td><code>storage.kine.dataSource</code></td>
70+
<td>Value in <code>spec.kineDataSourceURL</code></td>
71+
<td>Only set if <code>spec.kineDataSourceURL</code> is defined.</td>
72+
</tr>
73+
<tr>
74+
<td><code>storage.type</code></td>
75+
<td><code>kine</code></td>
76+
<td>Only set if <code>spec.kineDataSourceURL</code> is defined.</td>
77+
</tr>
78+
<tr>
79+
<td><code>storage.type</code></td>
80+
<td><code>etcd</code></td>
81+
<td>Only set if <code>spec.kineDataSourceURL</code> is not defined.</td>
82+
</tr>
83+
<tr>
84+
<td><code>storage.etcd.externalCluster.endpoints</code></td>
85+
<td><code>[https://kmc-&lt;cluster.name&gt;-etcd:2379]</code></td>
86+
<td>Only set if <code>spec.kineDataSourceURL</code> is not defined.</td>
87+
</tr>
88+
<tr>
89+
<td><code>storage.etcd.externalCluster.etcdPrefix</code></td>
90+
<td>Value in <code>metadata.name</code></td>
91+
<td>Only set if <code>spec.kineDataSourceURL</code> is not defined.</td>
92+
</tr>
93+
<tr>
94+
<td><code>storage.etcd.externalCluster.caFile</code></td>
95+
<td><code>/var/lib/k0s/pki/etcd-ca.crt</code></td>
96+
<td>Only set if <code>spec.kineDataSourceURL</code> is not defined.</td>
97+
</tr>
98+
<tr>
99+
<td><code>storage.etcd.externalCluster.clientCertFile</code></td>
100+
<td><code>/var/lib/k0s/pki/apiserver-etcd-client.crt</code></td>
101+
<td>Only set if <code>spec.kineDataSourceURL</code> is not defined.</td>
102+
</tr>
103+
<tr>
104+
<td><code>storage.etcd.externalCluster.clientKeyFile</code></td>
105+
<td><code>/var/lib/k0s/pki/apiserver-etcd-client.key</code></td>
106+
<td>Only set if <code>spec.kineDataSourceURL</code> is not defined.</td>
107+
</tr>
108+
</table>

0 commit comments

Comments
 (0)