Install Kubernetes

Canonical Kubernetes is pure upstream and works on any cloud, from bare metal to public and edge. Deploy single node and multi-node clusters with Charmed Kubernetes and MicroK8s to support container orchestration, from testing to production. Both distributions bring the latest innovations from the Kubernetes community within a week of upstream release, allowing for time to learn, experiment and upskill.

Get support for Kubernetes

Kubernetes deployment options

Canonical helps you be successful with Kubernetes, starting from where you want to deploy it and how you intend to use it.

Self-managed deployments give you greater control on Kubernetes infrastructure, from cloud to edge. Canonical Managed Kubernetes provides a hands-off experience with great economics.

Product Infrastructure Use case Enterprise Support Managed Kubernetes
MicroK8s
  • Laptops (Linux, Windows, macOS)
  • Workstations
  • Edge/Micro clouds
  • IoT devices
  • Opinionated Kubernetes
  • Small to medium clusters
  • CI/CD pipelines
Charmed Kubernetes
  • Bare metal
  • Private clouds
  • Public clouds
  • Hybrid clouds
  • Configurable Kubernetes
  • Medium to large clusters
Cloud Hosted (i)
  • Public clouds
  • Traffic peaks
Provided by the clouds
Kubeadm
  • Bare metal
  • Private clouds
  • Edge/Micro clouds
  • DIY Kubernetes
-

(i). Use Ubuntu’s platform to run worker nodes on all public clouds (AKS, EKS, and GKE)

Looking for help running Kubernetes? Get in touch ›

How to install Kubernetes

Single node Kubernetes with MicroK8s

MicroK8s installs a single node, CNCF-certified Kubernetes cluster in seconds

MicroK8s is a lightweight, zero-ops Kubernetes for Linux, Windows and macOS. A single command installs all upstream Kubernetes services and their dependencies. With support for x86 and ARM64, MicroK8s runs from local workstations to the edge and IoT appliances.

Learn more about Microk8s

Select platform for install steps
  1. Install MicroK8s on Linux

    sudo snap install microk8s --classic

    Don’t have the snap command? Get set for snaps

  2. Add your user to the microk8s admin group

    MicroK8s creates a group to enable seamless usage of commands which require admin privilege. Use the following commands to join the group:

    sudo usermod -a -G microk8s $USER
    sudo chown -f -R $USER ~/.kube

    You will also need to re-enter the session for the group update to take place:

    su - $USER
  3. Check the status while Kubernetes starts

    microk8s status --wait-ready
  4. Turn on the services you want

    microk8s enable dashboard dns ingress

    Try microk8s enable --help for a list of available services and optional features. microk8s disable ‹name› turns off a service.

  5. Start using Kubernetes

    microk8s kubectl get all --all-namespaces

    If you mainly use MicroK8s you can make our kubectl the default one on your command-line with alias mkctl=”microk8s kubectl”. Since it is a standard upstream kubectl, you can also drive other Kubernetes clusters with it by pointing to the respective kubeconfig file via the “--kubeconfig” argument.

  6. Access the Kubernetes dashboard

    microk8s dashboard-proxy
  7. Start and stop Kubernetes to save battery

    Kubernetes is a collection of system services that talk to each other all the time. If you don’t need them running in the background then you will save battery by stopping them. microk8s start and microk8s stop will do the work for you

    Read the docs to learn more

  1. Download the installer for Windows

  2. Run the installer

  3. Open a command line

  4. Check the status while Kubernetes starts

    microk8s status --wait-ready
  5. Turn on the services you want

    microk8s enable dashboard dns registry istio

    Try microk8s enable --help for a list of available services and optional features. microk8s disable ‹name› turns off a service.

  6. Start using Kubernetes

    microk8s kubectl get all --all-namespaces

    If you mainly use MicroK8s you can run the native Windows version of kubectl on your command-line.

    Learn how ›

  7. Access the Kubernetes dashboard

    microk8s dashboard-proxy
  8. Start and stop Kubernetes to save battery

    Kubernetes is a collection of system services that talk to each other all the time. If you don’t need them running in the background then you will save battery by stopping them. microk8s start and microk8s stop will do the work for you.

    Read the docs to learn more

  1. Install MicroK8s on macOS

    brew install ubuntu/microk8s/microk8s
    microk8s install

    Don't have the brew command? Get it from the Homebrew website.

  2. Check the status while Kubernetes starts

    microk8s status --wait-ready
  3. Turn on the services you want

    microk8s enable dashboard dns registry istio
  4. Start using Kubernetes

    microk8s kubectl get all --all-namespaces

    If you mainly use MicroK8s you can run the native macOS version of kubectl on your command-line.

    Learn how

  5. Access the Kubernetes dashboard

    microk8s dashboard-proxy
  6. Start and stop Kubernetes to save battery

    Kubernetes is a collection of system services that talk to each other all the time. If you don’t need them running in the background then you will save battery by stopping them. microk8s start and microk8s stop will do the work for you

    Read the docs to learn more

Multi-node clusters

Charmed Kubernetes installs CNCF-certified Kubernetes clusters across clouds

Charmed Kubernetes is a fully automated, model-driven approach to installing and managing Kubernetes from bare-metal to the cloud. Build your Kubernetes cloud from the ground up, integrate it with your favorite tools, and create multi-cloud topologies.

Learn more about Charmed Kubernetes ›

Select platform for install steps

These instructions represent the complete set of commands you need to enter into your terminal to install Charmed Kubernetes on your local machine with LXD. Be advised that the full installation of Charmed Kubernetes is only recommended for a machine with 32GB RAM and 250GB of SSD storage.

Not what you’re looking for? See our other guides ›

  1. Install LXD

    LXD is a system container and VM hypervisor that allows you to create a local cloud. It can be installed via a snap package.

    sudo snap install lxd --classic

    Don’t have the snap command? Get set for snaps

  2. Initialise LXD

    LXD provides an interactive dialogue to configure your local cloud during the initialisation procedure:

    lxd init

    The init script itself may vary depending on the version of LXD. You can use most default options in the dialogue. The important configuration options for Charmed Kubernetes are:

    • Networking: Do NOT enable ipv6 networking on the bridge interface
    • Storage Pool: Use the ‘dir’ storage type

    Facing issues? Read the troubleshooting guide ›

  3. Install Juju

    Juju is a tool for deploying, configuring and operating complex software on public or private clouds. It can be installed with a snap:

    sudo snap install juju --classic
  4. Add juju controller

    The Juju controller is used to manage the software deployed through Juju, from deployment to upgrades to day-two operations. One Juju controller can manage multiple projects or workspaces, which in Juju are known as ‘models’.

    Juju comes preconfigured to work with LXD. A cloud created by using LXD containers on the local machine is known as localhost to Juju. To begin, you need to create a Juju controller for this cloud:

    juju bootstrap localhost

    Find out more about Clouds in Juju

  5. Add a Kubernetes model

    The model holds a specific deployment. It is a good idea to create a new one specifically for each deployment.

    juju add-model k8s

    Remember that you can have multiple models on each controller, so you can deploy multiple Kubernetes clusters or other applications.

  6. Deploy Kubernetes

    Deploy the Kubernetes bundle to the model. This will add instances to the model and deploy the required applications. This can take up to 20 minutes depending on your machine.

    juju deploy charmed-kubernetes
  7. Monitor the deployment

    Juju is now busy creating instances, installing software and connecting the different parts of the cluster together, which can take several minutes. You can monitor what’s going on by running:

    watch -c juju status --color

    To view the last twenty log messages for the “k8s” model:

    juju debug-log -m k8s -n 20
  8. Start using your cluster!

    Congratulations! You have a Kubernetes cluster up and running - now let’s use it! The link below takes you to the operations guide, detailing some of the common things you’ll want to do next:

    Get started with your new cluster ›

These instructions represent the complete set of commands you need to enter into your terminal to install Charmed Kubernetes on AWS.

Not using AWS? See our other guides ›

  1. Install Juju

    Juju is a tool for deploying, configuring and operating complex software on public or private clouds. It can be installed with a snap:

    sudo snap install juju --classic
  2. Find your cloud

    Juju has baked-in knowledge of many public clouds such as AWS, Azure and Google. You can see which ones are ready to use by running this command:

    juju clouds

    Find out more about Clouds in Juju

  3. Add cloud credentials

    Most clouds require credentials so that the cloud knows which operations are authorised, so you will need to supply these for Juju. The command `add-credentials` offers a simple step-by-step wizard to connect Juju to your cloud. Other options are available here.

    juju add-credential aws
  4. Add juju controller

    The Juju controller is used to manage the software deployed through Juju, from deployment to upgrades to day-two operations. One Juju controller can manage multiple projects or workspaces, which in Juju are known as ‘models’.

    juju bootstrap aws my-controller
  5. Add a Kubernetes model

    The model holds a specific deployment. It is a good idea to create a new one specifically for each deployment.

    juju add-model k8s

    Remember that you can have multiple models on each controller, so you can deploy multiple Kubernetes clusters or other applications.

  6. Deploy Kubernetes

    Deploy the Kubernetes bundle to the model. This will add instances to the model and deploy the required applications. This can take up to 20 minutes depending on your machine.

    juju deploy charmed-kubernetes
  7. Monitor the deployment

    Juju is now busy creating instances, installing software and connecting the different parts of the cluster together, which can take several minutes. You can monitor what’s going on by running:

    watch -c juju status --color

    To view the last twenty log messages for the “k8s” model:

    juju debug-log -m k8s -n 20
  8. Start using your cluster!

    Congratulations! You have a Kubernetes cluster up and running - now let’s use it! The link below takes you to the operations guide, detailing some of the common things you’ll want to do next:

    Get started with your new cluster ›

These instructions represent the complete set of commands you need to enter into your terminal to install Charmed Kubernetes on Azure.

Not using Azure? See our other guides ›

  1. Install Juju

    Juju is a tool for deploying, configuring and operating complex software on public or private clouds. It can be installed with a snap:

    sudo snap install juju --classic
  2. Find your cloud

    Juju has baked-in knowledge of many public clouds such as AWS, Azure and Google. You can see which ones are ready to use by running this command:

    juju clouds

    Find out more about Clouds in Juju

  3. Add cloud credentials

    Most clouds require credentials so that the cloud knows which operations are authorised, so you will need to supply these for Juju. You can login with your Azure account and acquire your credentials using the Azure CLI. Then, you can add your credentials to Juju running:

    juju add-credential azure
  4. Add juju controller

    The Juju controller is used to manage the software deployed through Juju, from deployment to upgrades to day-two operations. One Juju controller can manage multiple projects or workspaces, which in Juju are known as ‘models’.

    juju bootstrap azure my-controller
  5. Add a Kubernetes model

    The model holds a specific deployment. It is a good idea to create a new one specifically for each deployment.

    juju add-model k8s

    Remember that you can have multiple models on each controller, so you can deploy multiple Kubernetes clusters or other applications.

  6. Deploy Kubernetes

    Deploy the Kubernetes bundle to the model. This will add instances to the model and deploy the required applications. This can take up to 20 minutes depending on your machine.

    juju deploy charmed-kubernetes
  7. Monitor the deployment

    Juju is now busy creating instances, installing software and connecting the different parts of the cluster together, which can take several minutes. You can monitor what’s going on by running:

    watch -c juju status --color

    To view the last twenty log messages for the “k8s” model:

    juju debug-log -m k8s -n 20
  8. Start using your cluster!

    Congratulations! You have a Kubernetes cluster up and running - now let’s use it! The link below takes you to the operations guide, detailing some of the common things you’ll want to do next:

    Get started with your new cluster ›

These instructions represent the complete set of commands you need to enter into your terminal to install Charmed Kubernetes on GCP.

Not using GCP? See our other guides ›

  1. Install Juju

    Juju is a tool for deploying, configuring and operating complex software on public or private clouds. It can be installed with a snap:

    sudo snap install juju --classic
  2. Find your cloud

    Juju has baked-in knowledge of many public clouds such as AWS, Azure and Google. You can see which ones are ready to use by running this command:

    juju clouds

    Find out more about Clouds in Juju

  3. Add cloud credentials

    Most clouds require credentials so that the cloud knows which operations are authorised, so you will need to supply these for Juju. Other options are available here.

    juju add-credential gcp
  4. Add juju controller

    The Juju controller is used to manage the software deployed through Juju, from deployment to upgrades to day-two operations. One Juju controller can manage multiple projects or workspaces, which in Juju are known as ‘models’.

    juju bootstrap gcp my-controller
  5. Add a Kubernetes model

    The model holds a specific deployment. It is a good idea to create a new one specifically for each deployment.

    juju add-model k8s

    Remember that you can have multiple models on each controller, so you can deploy multiple Kubernetes clusters or other applications.

  6. Deploy Kubernetes

    Deploy the Kubernetes bundle to the model. This will add instances to the model and deploy the required applications. This can take up to 20 minutes depending on your machine.

    juju deploy charmed-kubernetes
  7. Monitor the deployment

    Juju is now busy creating instances, installing software and connecting the different parts of the cluster together, which can take several minutes. You can monitor what’s going on by running:

    watch -c juju status --color

    To view the last twenty log messages for the “k8s” model:

    juju debug-log -m k8s -n 20
  8. Start using your cluster!

    Congratulations! You have a Kubernetes cluster up and running - now let’s use it! The link below takes you to the operations guide, detailing some of the common things you’ll want to do next:

    Get started with your new cluster ›

Multi-node, highly available Kubernetes with MicroK8s

To create a cluster out of two or more already-running MicroK8s instances, use the microk8s add-node command. As of MicroK8s 1.19, clustering of three or more nodes will automatically enable high availability.

The MicroK8s instance on which the command is run will host the Kubernetes control plane:

microk8s add-node

The add-node command prints a microk8s join command which should be executed on the MicroK8s instance(s) that you wish to join to the cluster (NOT THE NODE YOU RAN add-node FROM). For example:

microk8s join ip-172-31-20-243:25000/DDOkUupkmaBezNnMheTBqFYHLWINGDbf

Joining a node to the cluster should only take a few seconds. Afterwards you should be able to see the node has joined:

microk8s kubectl get no

Learn more about MicroK8s clustering

Read the docs

Charmed Kubernetes

If you want to know more about our enterprise multi-cloud Kubernetes read the Charmed Kubernetes documentation ›

MicroK8s

Are you a developer looking to quickly run local K8s clusters or an enterprise looking for K8s at the edge? Read the MicroK8s documentation

Juju

Curious to learn about our Charmed Operators and how they automate DevOps and application lifecycle tasks? Browse through the Charmed OLM documentation

Kubernetes resources

Need more help?

Let our Kubernetes experts help you take the next step.

Contact us