Portainer - UI for managing Containers

Portainer - UI for managing Containers

Portainer is an open-source, lightweight management UI that allows us to easily build and manage containers. This article explains how to install Portainer on a Kubernetes cluster and how to create a namespace and deploy an app.

What is Portainer?

Portainer is an open-source, lightweight management UI that allows us to quickly build and manage containers in Docker, Docker Swarm, Kubernetes, and Azure ACI. It will enable us to manage the creation and deletion of Swarm services, user authentication, authorizations, connecting, executing commands in the console of running containers, and viewing containers’ logs.
Portainer consists of a single container that can run on any cluster. It can be deployed as a Linux container or a Windows native container.
It is the most widely adopted container management platform in the world, with over 650,000 users and 21,700 stars on GitHub.

Why Portainer?

Portainer removes the complexity associated with deploying and managing containers

Portainer’s goal is to deliver a world-class container-native application deployment and management tool that is truly platform agnostic. They have made the underlying container management platform (e.g., Kubernetes) invisible to the engineers who want to manage their apps. If you use Portainer, we can CONSUME the container platform without being an expert in it.

Portainer streamlines the operations of container management

With Portainer, engineers can deploy and see the state of individual containers, restart them and debug them when necessary – all without needing to use the command line. Portainer also provides deep visibility into what’s running, where it's running, and how it's running, which helps engineers optimize app performance.
And because Portainer connects to all your hosts and platforms, you get complete visibility on a single web page, eliminating the need to connect to each container to check on its state. This saves time, and lets engineers focus on what’s important.

Portainer provides an enterprise sensitive tool that complies with IT governance best practice

Technology leaders need to be able to manage apps in a secure, repeatable, and scalable manner. Portainer provides a structured framework that enables this to happen and enables teams to work collaboratively. This reduces risk to your business and helps you be compliant in deploying and managing your applications.
Identity and Access Management (IAM) is a problem in native container platform management, and it’s a problem Portainer solves. It allows you to assign specific roles with pre-set functionality limits to users and teams and even nest roles to create fine-grained access rights.
And also, Portainer automatically logs all actions taken around container management, capturing details on who created, maintained, or even deleted containers – helping you trace any issues that might occur across your organization.

Portainer Architecture

Portainer architecture
Portainer architecture
Portainer consists of two elements: the Portainer Server and the Portainer Agent.
  • Both Portainer Server and Portainer Agent run as lightweight containers on your existing containerized infrastructure.
  • The Portainer Agent should be deployed to each node in your cluster and configured to report back to the Portainer Server container. A single Portainer Server will accept connections from any number of Portainer Agents, allowing one to manage multiple clusters from one centralized interface. To do this, the Portainer Server container requires data persistence.
  • The Portainer Agents are stateless, with data being shipped back to the Portainer Server container.

Features of Portainer

  • Application Deployment - Manage the deployment of containerized applications through a manual GUI or Simple GitOps.
  • Observability & Triage - Monitor the performance and behavior of containerized applications.
  • Centralized IAM - Control who can do what, when, and why inside your environment.
  • Platform Management - Set up and configure your environment - on-prem, in the cloud, or at the edge.

Portainer Products

Portainer is available in two versions: Community Edition (CE) and Business Edition (BE).
💥 Portainer CE
It is an open source software intended for personal use and supported by vibrant and growing community users.
Portainer Community Edition (CE) is the foundation. With over half a million regular users, CE is a powerful, open-source toolset that allows you to quickly build and manage containers in Docker, Docker Swarm, Kubernetes, and Azure ACI.
💥 Portainer BE
Portainer BE is a commercially licensed and supported product. It adds enterprise features to CE to support enterprise requirements and is intended for professional use.
Portainer Business Edition (BE) is the commercial offering. With features geared towards businesses and larger organizations such as Role-Based Access Control, registry management, and dedicated support, Portainer BE is a powerful toolset that allows you to easily build and manage containers in Docker, Docker Swarm, Kubernetes and Azure ACI.

Installation

Check out the official documentation for Portainer installation according to your requirements.
💥 In this blog post, I will be using helm to install Portainer.

Prerequisites

  1. A working and up-to-date Kubernetes cluster. Check out this blog post for instructions on setting up your Kubernetes cluster.
  2. Access to run helm or kubectl commands on your cluster.
  3. Cluster Admin rights on your Kubernetes cluster. This is so Portainer can create the necessary ServiceAccount and ClusterRoleBinding for it to access the Kubernetes cluster.
  4. A default StorageClass configured.
So, let's get started 🚀🥳
👉 Check if you have a default StorageClass by running the following command on your cluster:
kubectl get sc
📌 If the storage class is not set as default, then we can use the below command to set a default storage class.
kubectl patch storageclass <storage-class-name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
📌 replacing <storage-class-name> with the name of your StorageClass. Alternatively, if you are installing using our Helm chart, you can pass the following parameter in your helm install command to specify the StorageClass to use for Portainer:
--set persistence.storageClass=<storage-class-name>
📌 In my case, it's already set as default.
Helm and StorageClass
Helm and StorageClass
👉 Now, add the Portainer Helm repository by running the following commands:
helm repo add portainer https://portainer.github.io/k8s/
helm repo update
Helm - add repo and update
Helm - add repo and update
👉 Install the helm chart:
helm install --create-namespace -n portainer portainer  portainer/portainer
Helm - install Portainer chart
Helm - install Portainer chart
👉 Check the service
kubectl get svc -n portainer
Portainer - Kubernetes service
Portainer - Kubernetes service
👉 To access the portainer service from the local environment on port 30777, traffic can be forwarded to your local system using the port-forward command:
kubectl port-forward -n portainer svc/portainer 30777:9000
Portainer - port forward
Portainer - port forward
👉 Open a web browser and navigate to the following URL:
http://localhost:30777
Portainer - admin UI
Portainer - admin UI
📌 Now, set the username and password, then click on Create user.
Portainer - create user
Portainer - create user
📌 Click on Get started
Portainer - Get started
Portainer - Get started
Now, we are all set to explore the Portainer UI 🥳
🔰 Choose our environment, and then we will land on the dashboard from where we can manage the cluster.
Portainer - UI
Portainer - UI
Portainer - UI
Portainer - UI

Now, let's do some hands-on practical examples 🚀

📌 Click on the Namespace, you will see the default namespace
Portainer - default namespace
Portainer - default namespace
📌 Click on the Add Namespace with form button
Portainer - add namespace with form
Portainer - add namespace with form
📌 Give the name, set the memory and CPU limits, and then click on the Create namespace
Portainer - new namespace
Portainer - new namespace
📌 Let's see the namespace list
Portainer - namespace list
Portainer - namespace list
So, we have successfully created our namespace 🤩!
👉Now, let's create an application in our namespace that we created above.
📌 Click on Applications
Portainer - applications
Portainer - applications
📌 Click on Add application with form
Portainer - applications
Portainer - applications
📌 Select the namespace we created from the dropdown, provide the application name (nginx:latest), image name (test-app), and select service type (LoadBalancer).
Portainer - applications
Portainer - applications
Portainer - applications
Portainer - applications
📌 Let's see the application list
Portainer - applications
Portainer - applications
Wooooh, we have successfully created our application 🥳

Conclusion

Portainer is a great tool that can be used to manage Docker containers, Swarm services, and other resources from a simple and intuitive web user interface. Portainer provides several free features and paid plugins to enhance the user experience for managing Docker clusters. On the other hand, some paid plugins still have some restrictions or missing features that could improve the product.
💥 I hope this blog will help you understand how Portainer manages containers.

Related Posts

;