fbpx

Fortunately, MicroK8s offers a lightweight and straightforward solution for running Kubernetes on your local machine, or on a single VPS. In this guide, we’ll walk you through the step-by-step process of installing MicroK8s and getting started with local Kubernetes development. Kubernetes has become the de facto standard for container orchestration, allowing developers to manage and deploy applications at scale. While Kubernetes is powerful, setting up a local development environment can be a daunting task.

How to install a local Kubernetes with MicroK8s

Section 1: Preparing the Environment

Before diving into the installation process, ensure that your system meets the following requirements:

  1. A Linux-based distribution (MicroK8s is primarily designed for Linux)
  2. A machine with at least 2 CPU cores and 2GB of RAM
  3. Snap package manager installed (pre-installed on most modern Linux distributions)

Section 2: Installing MicroK8s

Open a terminal and execute the following command to install MicroK8s:

sudo snap install microk8s --classic

This command will download and install the MicroK8s snap package on your system.

Once the installation is complete, add your user to the ‘microk8s’ group using the following command:

sudo usermod -a -G microk8s your-username

Replace <your-username> with your actual username. This step allows your user to access the MicroK8s cluster.

To enable some essential add-ons, run the following commands one by one:

microk8s enable dashboard dns storage

These add-ons provide a graphical dashboard for managing your cluster, DNS resolution for services, and persistent storage support.

How to install a local Kubernetes with MicroK8s

Section 3: Configuring

To access the Kubernetes cluster, you need to configure the command-line tool, kubectl. Execute the following command to set up kubectl:

microk8s kubectl config view --raw > $HOME/.kube/config

This command saves the configuration file required by kubectl in the default location.

Confirm that MicroK8s is up and running by checking the cluster status:

microk8s status --wait-ready

Once all the components are listed as ‘running,’ you’re ready to proceed.

Section 4: Testing the Cluster

Verify that the cluster is functioning correctly by running the following command:

microk8s kubectl get nodes

If everything is set up correctly, you should see a single node listed as ‘Ready.’

Additionally, you can check the status of the installed add-ons by running:

microk8s kubectl get pods --all-namespaces

This command displays all the running pods in the cluster, along with their namespaces.

Section 5: Interacting with the Cluster

To access the Kubernetes dashboard, use the following command:

microk8s dashboard-proxy

This command starts a proxy server that allows you to access the dashboard through your web browser. Open your browser and visit http://localhost:8001 to access the Kubernetes dashboard.

To stop the MicroK8s cluster when you’re done, execute:

microk8s stop

This command shuts down the cluster, freeing up system resources.

If you need a high-quality server for your Microk8s cluster you can choose from our 29 data centers are located around the world, and we’re proud to offer our services in these locations:

  1. Los Angeles, CA, United States
  2. Dallas, TX, United States
  3. Miami, FL, United States
  4. New York, NY, United States
  5. Montreal, Canada
  6. Dublin, Ireland
  7. Manchester, United Kingdom
  8. London, United Kingdom
  9. Paris, France
  10. Madrid, Spain
  11. Bruxelles, Belgium
  12. Amsterdam, Netherlands
  13. Oslo, Norway
  14. Stockholm, Sweden
  15. Copenhagen, Denmark
  16. Frankfurt, Germany
  17. Warsaw, Poland
  18. Prague, Czech Republic
  19. Vienna, Austria
  20. Zurich, Switzerland
  21. Milan, Italy
  22. Budapest, Hungary
  23. Belgrade, Serbia
  24. Sofia, Bulgaria
  25. Bucharest, Romania
  26. Singapore
  27. Hong Kong
  28. Tokyo, Japan
  29. Sydney, Australia

Final Thoughts

Setting up a local Kubernetes environment is essential for developing and testing applications before deploying them to a production cluster. MicroK8s provides a simple and lightweight solution for running Kubernetes on your local machine. In this guide, we walked through the installation process, configuration steps, and how to interact with the MicroK8s cluster. With your local Kubernetes environment up and running, you’re now ready to dive into the world of containerized application development and orchestration. Happy Kubernetizing!


2 Comments

How To Install Kubernetes Cert-Manager - Virtono Community · May 22, 2023 at 9:18 AM

[…] You have successfully installed Kubernetes Cert-Manager and obtained a certificate using it. You can now use the certificate in your […]

How To Install Mayastor Add-on On MicroK8s - Virtono Community · May 22, 2023 at 1:29 PM

[…] this article, we will guide you through the step-by-step process of installing the Mayastor Add-on. MicroK8s, a lightweight Kubernetes distribution, offers a convenient way to deploy Kubernetes clusters for […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.