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.
How to deploy Kubernetes
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 |
|
|
|
|
Charmed Kubernetes |
|
|
|
|
Cloud Hosted (i) |
|
|
|
Provided by the clouds |
Kubeadm |
|
|
|
- |
(i). Use Ubuntu’s platform to run worker nodes on all public clouds (AKS, EKS, and GKE)
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.
Select platform for install steps
-
Install MicroK8s on Linux
sudo snap install microk8s --classic
Don’t have the snap command? Get set for snaps
-
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
-
Check the status while Kubernetes starts
microk8s status --wait-ready
-
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. -
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. -
Access the Kubernetes dashboard
microk8s dashboard-proxy
-
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
andmicrok8s stop
will do the work for you
-
Download the installer for Windows
-
Run the installer
-
Open a command line
-
Check the status while Kubernetes starts
microk8s status --wait-ready
-
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. -
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.
-
Access the Kubernetes dashboard
microk8s dashboard-proxy
-
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.
-
Install MicroK8s on macOS
brew install ubuntu/microk8s/microk8s
microk8s install
Don't have the brew command? Get it from the Homebrew website.
-
Check the status while Kubernetes starts
microk8s status --wait-ready
-
Turn on the services you want
microk8s enable dashboard dns registry istio
-
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.
-
Access the Kubernetes dashboard
microk8s dashboard-proxy
-
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
andmicrok8s stop
will do the work for you
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.
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 ›
-
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
-
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
-
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
-
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
-
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.
-
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
-
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
-
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:
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 ›
-
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
-
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
-
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
-
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
-
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.
-
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
-
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
-
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:
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 ›
-
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
-
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
-
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
-
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
-
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.
-
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
-
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
-
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:
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 ›
-
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
-
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
-
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
-
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
-
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.
-
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
-
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
-
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:
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
Read the docs
If you want to know more about our enterprise multi-cloud Kubernetes read the Charmed Kubernetes documentation ›
Are you a developer looking to quickly run local K8s clusters or an enterprise looking for K8s at the edge? Read the MicroK8s documentation
Curious to learn about our Charmed Operators and how they automate DevOps and application lifecycle tasks? Browse through the Charmed OLM documentation