Configuration#
K0smotron managed control planes are managed using custom resource objects.
apiVersion: k0smotron.io/v1beta1
kind: Cluster
metadata:
name: k0smotron-test
spec:
replicas: 1
image: quay.io/k0sproject/k0s
version: v1.27.1-k0s.0
service:
type: NodePort
apiPort: 30443
konnectivityPort: 30132
persistence:
type: emptyDir
For full reference of the fields check out the reference docs.
Persistence#
K0smotron persists data related to each Cluster. Specifically, it persists the /var/lib/k0s
directory of the k0s controller which is the default data directory used by k0s.
The /var/lib/k0s
directory contains essential data for the operation of the k0s controller, but its growth over time is primarily driven by the addition of small manifest files. Since these manifests are lightweight and in text format, the directory tends to grow gradually and not excessively. Typically, 250 MB of space is sufficient to handle its growth, as the main additions are these small manifests, keeping the overall size manageable.
The type of persistence used for this can be configurable via spec.persistence
. For more information, check out the reference docs on Cluster persistence.
K0s configuration#
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.
Refer to k0s docs for a reference on configuring k0s via the ClusterConfig resource.
ClusterConfig for K0smotron#
K0smotron can automatically generate spec.k0sConfig
or override some fields (if provided) based on the values provided for the Cluster resource, following specific configuration rules:
ClusterConfig Field | Value | Condition |
---|---|---|
api.externalAddress |
Value in spec.externalAddress if provided. Otherwise, depending of the service type, K0smotron attempts to detect an external address from the load balancer or available node IPs. |
Only set if nodeLocalLoadBalancing.enabled is false . |
api.port |
Value in spec.service.apiPort |
Always. |
api.sans |
[<spec.externalAddress>, <cluster-svc-ips>, <cluster-service-name>, <cluster-service-name-namespaced>, <cluster-service-name-DNS>], <cluster-service-name-FQDNS> plus the possible provided ones. |
Always. |
konnectivity.port |
Value in spec.service.konnectivityPort |
Always. |
storage.kine.dataSource |
Value in spec.kineDataSourceURL |
Only set if spec.kineDataSourceURL is defined. |
storage.type |
kine |
Only set if spec.kineDataSourceURL is defined. |
storage.type |
etcd |
Only set if spec.kineDataSourceURL is not defined. |
storage.etcd.externalCluster.endpoints |
[https://kmc-<cluster.name>-etcd:2379] |
Only set if spec.kineDataSourceURL is not defined. |
storage.etcd.externalCluster.etcdPrefix |
Value in metadata.name |
Only set if spec.kineDataSourceURL is not defined. |
storage.etcd.externalCluster.caFile |
/var/lib/k0s/pki/etcd-ca.crt |
Only set if spec.kineDataSourceURL is not defined. |
storage.etcd.externalCluster.clientCertFile |
/var/lib/k0s/pki/apiserver-etcd-client.crt |
Only set if spec.kineDataSourceURL is not defined. |
storage.etcd.externalCluster.clientKeyFile |
/var/lib/k0s/pki/apiserver-etcd-client.key |
Only set if spec.kineDataSourceURL is not defined. |