---
title: How to use launch configurations
description: Canonical makes open source secure, reliable and easy to use, providing
  support for Ubuntu and a portfolio of enterprise-grade technologies. Founded in
  2004, Canonical operates globally with team members in over 80 countries.
url: https://canonical.com/microk8s/docs/add-launch-config?format=md
---

*Submit*

# How to use launch configurations

In this HowTo we present the three ways launch configurations can be applied on a local MicroK8s node. In this guide, we will use the following configuration file, which deploys a MicroK8s node and enables the `dns`, `ingress`, `rbac`, `hostpath-storage` and `registry` addons automatically. See the [launch configurations reference](https://canonical.com/microk8s/docs/ref-launch-config) for a reference of all possible configuration options as well as examples.

```
# microk8s-config.yaml
---
version: 0.1.0
addons:
  - name: dns
  - name: rbac
  - name: ingress
  - name: hostpath-storage
  - name: registry

# The extra arguments listed here are not required, as they would be set by the 'rbac' and the 'dns'
# addons respectively. However, we set them to save time by not having to restart the Kubernetes
# services a few times during cluster bootstrap.
extraKubeAPIServerArgs:
  --authorization-mode: RBAC,Node
extraKubeletArgs:
  --cluster-dns: 10.152.183.10
  --cluster-domain: cluster.local
```

### [1. When deploying a cluster](https://canonical.com/microk8s/docs/add-launch-config?format=md#p-38727-h-1-when-deploying-a-cluster)

Starting with version 1.27, MicroK8s contains a [default launch configuration](https://github.com/canonical/microk8s/blob/master/microk8s-resources/microk8s.default.yaml) that automatically enables the `dns` addon for newly deployed clusters. It is possible to override the default launch configuration by creating `/var/snap/microk8s/common/.microk8s.yaml` like this:

```
sudo mkdir -p /var/snap/microk8s/common/
sudo cp microk8s-config.yaml /var/snap/microk8s/common/.microk8s.yaml
```

Similarly, to automatically sideload OCI images into the container runtime, add any `.tar` archives to `/var/snap/microk8s/common/sideload/<image>.tar`:

```
sudo mkdir -p /var/snap/microk8s/common/sideload
sudo cp *.tar /var/snap/microk8s/common/sideload/
```

The configuration file will be picked up automatically during the `snap install microk8s` command. After creating the launch configuration file, install MicroK8s as you normally would:

```
sudo snap install microk8s --classic --channel 1.27
```

And then wait for the cluster to come up. After a while, list the running pods with `sudo microk8s kubectl get pod -A` and you should see:

```
NAMESPACE            NAME                                      READY   STATUS    RESTARTS   AGE
kube-system          calico-node-wtjk2                         1/1     Running   0          2m25s
kube-system          coredns-f58c55f4c-xw87l                   1/1     Running   0          2m37s
kube-system          hostpath-provisioner-69cd9ff5b8-njtpc     1/1     Running   0          2m33s
kube-system          calico-kube-controllers-57b57c56f-wcj57   1/1     Running   0          2m25s
container-registry   registry-77c7575667-66kvf                 1/1     Running   0          2m20s
ingress              nginx-ingress-microk8s-controller-s9wft   1/1     Running   0          2m13s
```

> *NOTE*: When installing MicroK8s with an invalid launch configuration file, the `snap install microk8s` command will fail.

### [2. Using `snap set`](https://canonical.com/microk8s/docs/add-launch-config?format=md#p-38727-h-2-using-snap-set)

It is also possible to set a launch configuration on an existing cluster using the `snap set microk8s config=<contents>` command.

First, install MicroK8s:

```
sudo snap install microk8s --classic --channel 1.27
```

Then, apply the launch configuration by setting the `config` config option. The option value must be the file contents, not the path:

```
sudo snap set microk8s config="$(cat microk8s-config.yaml)"
```

After a while, the configuration is applied to the local node.

### [3. Using a content snap](https://canonical.com/microk8s/docs/add-launch-config?format=md#p-38727-h-3-using-a-content-snap)

This method is only supported when running MicroK8s with [strict-confinement](https://microk8s.io/docs/install-strict). This method makes sense in large scale deployments where the operator wants to control the launch configuration of a large fleet of machines, and requires the development and installation of an extra “content snap”. The content snap is built with the custom launch configuration of the operator, and the configuration is applied by connecting the content snap to MicroK8s.

See [microk8s-content-demo-snap](https://github.com/canonical/microk8s-content-demo-snap) for an example content snap. You can use it to scaffold your own content snaps. The [readme](https://github.com/canonical/microk8s-content-demo-snap#readme) contains instructions for editing and building the content snap.

When using a content snap, the installation process looks like this:

First, install the content snap on the host:

```
# install content snap from the store...
sudo snap install content-demo-microk8s

# ... or from a local file
sudo snap install ./content-demo-microk8s.snap --dangerous
```

Then, install MicroK8s with strict-confinement:

```
sudo snap install microk8s --channel 1.27-strict
```

Finally, connect the content snap (replace `content-demo-microk8s` with your own content snap name):

```
sudo snap connect content-demo-microk8s:configuration microk8s
```

After a while, the configuration is applied to the local node.

Last updated 3 years ago. [Help improve this document in the forum](https://discuss.kubernetes.io/t/how-to-use-launch-configurations/23359).
