In this tutorial, we are going to explore how to install K3s and Helm. K3s is a lightweight Kubernetes distribution designed for developers and operators looking for a method to run Kubernetes in resource-constrained environments. Helm, on the other hand, is a package manager for Kubernetes that simplifies the deployment of applications.
Step 1: Install K3s
K3s aims to be a production-grade Kubernetes distribution that is fully compliant with the following changes:
- Features that are old, beta, or not by default are removed. There are separate add-ons for many of these features.
- The storage driver is replaced with either overlayfs or fuse-overlayfs.
- It uses containerd instead of Docker as the container runtime.
- Ingress is provided by Traefik.
Let’s start with the steps for installing K3s:
Step 2: Update Your System
It is always advised to update the system and all packages before installing any package. Use the following command:
apt-get update && apt-get upgrade -y
Step 3: Download and Install K3s
The installation script that K3s offers makes it simple to download and include K3s in the system services.
curl -sfL https://get.k3s.io | sh -
The command mentioned above will download and install K3s. Additionally, the script will produce a systemd service file that launches K3s at boot.
To verify the installation, use:
sudo k3s kubectl get node
If K3s is installed correctly, you should see the name of your server in the output.
Copy the K3s kubeconfig
file to your home directory:
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $(id -u):$(id -g) ~/.kube/config
Step 4: Check K3s Service and version
To verify whether K3s has started successfully, use the following command:
systemctl status k3s
To check the version of installed K3s, use the following command:
k3s --version
k3s version v1.27.3+k3s1 (fe9604ca)
go version go1.20.5
Step 5: Install Helm
Helm is a Kubernetes package manager that makes it simpler for developers and administrators to organize, set up, and deploy applications and services onto Kubernetes clusters. The CNCF, in conjunction with Microsoft, Google, Bitnami, and the Helm contributor community, maintains Helm.
Start by downloading the most recent Helm binary executable from the Helm project’s official GitHub releases page.
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
Then, you need to add execute permissions to the downloaded script and run it:
chmod 700 get_helm.sh
./get_helm.sh
Step 6: Deploying an Application with Helm on K3s
WordPress is a popular content management system (CMS) used by millions of websites worldwide. Helm makes it easy to deploy a WordPress site on your Kubernetes cluster. Here’s how to do it:
For a variety of applications, Bitnami offers pre-configured Helm charts. Run the following command to include the Bitnami Helm repository:
helm repo add bitnami https://charts.bitnami.com/bitnami
To make sure you have the most recent charts, it’s always a good idea to update your Helm repositories after adding a new repository. Execute the following command:
helm repo update
Now, you’re ready to install WordPress. Run the following command:
helm install wordpress bitnami/wordpress
Using the Bitnami repository, this command installs the WordPress chart. The chart’s release name is “wordpress”. Any alternative name is acceptable in its place.
To verify the deployment, you can check the status of the Kubernetes pods:
kubectl get pods
NAME READY STATUS RESTARTS AGE
wordpress-mariadb-0 1/1 Running 0 3m52s
wordpress-5d557f4bb4-4lvpd 1/1 Running 0 3m52s
To get the default credentials, run the following command:
echo Password: $(kubectl get secret --namespace default wordpress -o jsonpath="{.data.wordpress-password}" | base64 --decode)
Final Thoughts
The basic concepts of installing K3s, Helm, and deploying an application on a K3s cluster are covered in this tutorial. Helm and K3s are both powerful tools that make Kubernetes deployment and application management easier. They are necessary tools for any operator or developer using Kubernetes.
9 Comments
How To Deploy Prometheus On Kubernetes - Virtono Community · July 30, 2023 at 9:32 AM
[…] you’ve already installed Helm and K3s. If you don’t have K3s and Helm installed you can follow our guide. Prometheus has established itself as a top open-source option for monitoring and alerting systems. […]
How To Deploy Jenkins On Kubernetes - Virtono Community · August 2, 2023 at 11:46 AM
[…] K3s and Helm are installed on your system, here is a tutorial on how to install K3s and Helm. […]
How To Deploy InfluxDB On Kubernetes - Virtono Community · August 4, 2023 at 1:17 PM
[…] that you already have K3s installed and Helm configured. If K3s and Helm are not installed you learn how to install them here. We will also assume that you have a single K3s cluster without nodes. Let’s get […]
How To Deploy MinIO On Kubernetes - Virtono Community · August 23, 2023 at 10:33 AM
[…] will examine how to deploy MinIO on Kubernetes in this article. We’re assuming that K3S and Helm are already set up on your VM. Let’s get […]
How To Deploy Nextcloud On Kubernetes - Virtono Community · August 25, 2023 at 2:57 PM
[…] be using k3s, a lightweight Kubernetes distribution. We’ll assume that you’ve already installed k3s and Helm on your […]
How To Deploy Jaeger On Kubernetes - Virtono Community · September 5, 2023 at 12:04 PM
[…] guide you through the process of deploying Jaeger on Kubernetes, assuming that you already have K3s and Helm installed in your environment. Tracing and monitoring are essential in the world of microservices and […]
How To Deploy Zipkin On Kubernetes - Virtono Community · September 6, 2023 at 9:08 AM
[…] A functioning Virtono Kubernetes cluster (K3s), you can find the installation guide here […]
How To Deploy RabbitMQ On Kubernetes - Virtono Community · September 7, 2023 at 10:35 AM
[…] A Kubernetes cluster running (for this guide, we are using K3s). Check the installation guide here. […]
How To Deploy ArgoCD On Kubernetes - Virtono Community · October 3, 2023 at 5:26 PM
[…] A Kubernetes cluster. If you don’t already have a Kubernetes cluster, follow our article that helps you setup a Kubernetes cluster using K3s: [The K3s quick start guide] […]