k8s-ubuntu

How to Easily Install Kubernetes on Ubuntu 24.04 [Beginner Friendly]

Spread the love

Ubuntu is an open-source Linux-based operating system owned and managed by Canonical. Ubuntu is one of the friendliest versions of Linux. It has both a desktop version and a server version. Ubuntu 24.04 was released earlier this year. This article is not focused on Ubuntu itself as an operating system or its release, but on how to deploy Kubernetes in this new version of Ubuntu.

Installing Kubernetes in Ubuntu

Before installing Kubernetes in Ubuntu, it is important to understand that Kubernetes can run in two major modes

  • Single Node mode – for testing, practice, and demonstration purposes
  • Cluster mode – for production and running critical workloads.

Kubernetes can run in both modes on Ubuntu, depending on the purpose for which it is needed. To install Kubernetes in a single-node mode, here are the instructions:

Deploy a Single-Node Kubernetes on Ubuntu

To install a single-node Kubernetes cluster, you need to install Ubuntu on your machine or set up Ubuntu 24.04 on a cloud provider, such as Amazon EC2 or Amazon Lightsail. Also, ensure that the Ubuntu server is accessible over SSH. Log in to the instance. On the terminal, run the following commands to install Kubernetes in a single node:

Using snap to Install

Install Kubernetes

# sudo snap install k8s --classic

k8s (1.32-classic/stable) v1.32.5 from Canonical✓ installed

Boot up/Bootstrap the Kubernetes that has been installed

# sudo k8s bootstrap

Bootstrapping the cluster. This may take a few seconds, please wait.
Bootstrapped a new Kubernetes cluster with node address "172.26.12.240:6400".
The node will be 'Ready' to host workloads after the CNI is deployed successfully.

Validate that Kubernetes is running

# sudo k8s status

cluster status: not ready
control plane nodes: 172.26.12.240:6400 (voter)
high availability: no
datastore: k8s-dqlite
network: enabled
dns: enabled at 10.152.183.71
ingress: disabled
load-balancer: disabled
local-storage: enabled at /var/snap/k8s/common/rawfile-storage
gateway Failed to deploy Cilium Gateway, the error was failed to upgrade Gateway API cilium configuration: cannot upgr
ade ck-network as it is not installed
# sudo k8s kubectl get all --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/cilium-bwwd9 1/1 Running 0 2m35s
kube-system pod/cilium-operator-6469dbc95b-2nq7x 1/1 Running 0 3m23s
kube-system pod/ck-storage-rawfile-csi-controller-0 2/2 Running 0 4m3s
kube-system pod/ck-storage-rawfile-csi-node-r9xpg 4/4 Running 0 4m3s
kube-system pod/coredns-fc9c778db-p9229 1/1 Running 0 4m8s
kube-system pod/metrics-server-8694c96fb7-24n4l 1/1 Running 0 4m7s

NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 4m22s
kube-system service/ck-storage-rawfile-csi-controller ClusterIP None <none> <none> 4m5s
kube-system service/ck-storage-rawfile-csi-node ClusterIP 10.152.183.197 <none> 9100/TCP 4m5s
kube-system service/coredns ClusterIP 10.152.183.71 <none> 53/UDP,53/TCP 4m10s
kube-system service/hubble-peer ClusterIP 10.152.183.83 <none> 443/TCP 3m59s
kube-system service/metrics-server ClusterIP 10.152.183.97 <none> 443/TCP 4m9s

NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR 
AGE
kube-system daemonset.apps/cilium 1 1 1 1 1 kubernetes.io/os=linux 
3m59s
kube-system daemonset.apps/ck-storage-rawfile-csi-node 1 1 1 1 1 <none> 
4m4s

NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/cilium-operator 1/1 1 1 3m59s
kube-system deployment.apps/coredns 1/1 1 1 4m10s
kube-system deployment.apps/metrics-server 1/1 1 1 4m8s

NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/cilium-operator-6469dbc95b 1 1 1 3m23s
kube-system replicaset.apps/cilium-operator-6978488575 0 0 0 3m59s
kube-system replicaset.apps/coredns-fc9c778db 1 1 1 4m9s
kube-system replicaset.apps/metrics-server-8694c96fb7 1 1 1 4m8s

NAMESPACE NAME READY AGE
kube-system statefulset.apps/ck-storage-rawfile-csi-controller 1/1 4m4s

With Kubernetes deployed and running, you can start to administer it using the A sudo k8s kubectl command to manage the cluster.

Cluster mode Deployment

Cluster mode deployment is meant for systems that require production-grade scalability and availability. Tools like Amazon EKS provide that, and you can configure the worker nodes to use the AMI for Ubuntu 24.04. That way, your workload deployed in the cluster runs on the latest version of Ubuntu. You can also set up Kubernetes using the official Kubernetes setup tools called kubeadm.

Conclusion

There are various ways to deploy Kubernetes on Ubuntu, this approach is a simple and quick way to get up and running with Kubernetes on Ubuntu 24.04. A scalable approach to deploying Kubernetes is to either use a managed service or kubeadm to set up the Kubernetes cluster for more advanced usage.


Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
×