Skip to content

Upgrade the data directory#

To minimize the potential friction you may encounter in upgrading from MKE 3 to MKE 4k, Mirantis offers the approach detailed herein for persisting and reusing your existing data assets.

MKE 3 clusters can have specific physical allocated partitions that serve as the root directory for their runtime Docker. By default, this path is /var/lib/docker, a partition that is often allocated and sized in advance.

By default, MKE 4k uses /var/lib/k0s as the writable root directory for its components. To promote a smooth upgrade and avoid partition modifications, though, MKE 4k supports the configuration of all necessary writable paths within the existing directory as subdirectories. This allows customers to leverage the pre-allocated space in the MKE 3 root directory, which minimizes disruption and eliminates the need for any infrastructural changes. Thus, you can configure MKE 4k to use that directory as its root directory as long as a subdirectory named k0s can be created as a writable path in that existing root directory.

You must specify which data directory to use for your MKE 4k cluster at the time you are:

  • Installing a new MKE 4k cluster
  • Upgrading an MKE 3 cluster to MKE 4k

To specify the data directory for a new MKE 4k cluster:

Use spec.providerSpecs.k0sProviderSpecs.k0sDataDir, as shown below:

apiVersion: mke.mirantis.com/v1alpha1
kind: MkeConfig
metadata:
  creationTimestamp: null
  name: mke
  namespace: mke
spec: 
  [...]
  providerSpecs:
    k0sProviderSpecs:
      k0sDataDir: /var/lib/k0s
  [...]

To specify the data directory for an MKE 3 cluster being upgraded to MKE 4k:

When you upgrade an MKE 3 cluster to MKE 4k, use the --data-dir parameter of the mkectl upgrade command to specify the data directory that the new MKE 4k cluster will use thereafter.

Warning

You must not use /var/lib/docker or /var/lib/containerd as the data-dir value. You can, however, specify sub-directories of these two directories, such as /var/lib/docker/k0s or /var/lib/containerd/k0s.

The following mkectl commands can accept data directory arguments [--data-dir, string type]:

  • The init command prints the default configuration with the above value pre-configured and in use for other values, such as audit logs, the default location of which is used to derive their value.

  • The upgrade command is applicable only to upgrades from MKE 3 to MK 4k upgrades.

Note

If encryptionProvider is a subpath of the path specified by dataDir, then encryption provider setup is managed by the system, which includes keeping it in sync on all manager nodes. Otherwise, if the path encryptionProvider is not a subpath of the path specified by dataDir, you must provide the encryption configuration at the configured path and must also ensure that the file is available on all manager nodes at all times.