Saiyam Pathak

Saiyam Pathak

Portainer 2.0

Portainer 2.0

Subscribe to my newsletter and never miss my upcoming articles

Portainer is very popular among the docker community for its container management and guess what! now Portainer has extended this management to Kubernetes. Yes, It's True, Portainer 2.0 is coming and it's huge, as it now comes with KUBERNETES Management. In this post, I will walk through portainer 2.0 and some of its features.

We will cover below scenarios:

  • Installing Portainer on Managed k3s by Civo Cloud

  • Installing Portainer Agent on GKE

Installing Portainer on Managed k3s

  • Create a civo k3s cluster

  • Download the Kubeconfig file

  • Install Portainer directly on the cluster
**curl -LO [https://raw.githubusercontent.com/portainer/portainer-k8s/master/portainer-nodeport.yaml](https://raw.githubusercontent.com/portainer/portainer-k8s/master/portainer-nodeport.yaml)**

kubectl apply -f portainer-nodeport.yaml
namespace/portainer created
serviceaccount/portainer-sa-clusteradmin created
clusterrolebinding.rbac.authorization.k8s.io/portainer-crb-clusteradmin created
service/portainer created
deployment.apps/portainer created

kubectl get svc -n portainer
NAME        TYPE       CLUSTER-IP        EXTERNAL-IP   PORT(S)                         AGE
portainer   NodePort   192.168.159.221   <none>        9000:30777/TCP,8000:30776/TCP   13s

click on kubernetesclick on kubernetes

The Managed k3s cluster gets imported

Installing Portainer-agent on GKE:

Create a simple plain default GKE cluster

GKE cluster CreationGKE cluster Creation

Connect to the cloud shell in order to Run Portainer Agent

Install Portainer Agent Load Balancer:

**gcloud container clusters get-credentials portainer --zone us-central1-c --project playground-s-11-14726b37**
Fetching cluster endpoint and auth data.
kubeconfig entry generated for portainer.

curl -L https://downloads.portainer.io/portainer-agent-k8s-lb.yaml -o portainer-agent-k8s.yaml; kubectl apply -
f portainer-agent-k8s.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1599  100  1599    0     0   1169      0  0:00:01  0:00:01 --:--:--  1169

namespace/portainer created
serviceaccount/portainer-sa-clusteradmin created
clusterrolebinding.rbac.authorization.k8s.io/portainer-crb-clusteradmin created
service/portainer-agent created
service/portainer-agent-headless created
deployment.apps/portainer-agent created

kubectl get svc -n portainer
NAME                       TYPE           CLUSTER-IP    EXTERNAL-IP     PORT(S)          AGE
portainer-agent            LoadBalancer   10.28.7.233   35.238.43.218   9001:31739/TCP   84s
portainer-agent-headless   ClusterIP      None          <none>          <none>           82s

Create an Endpoint for GKE in the Portainer UI and enter the Endpoint URL as the <Load Balancer IP of Portainer-agent>:9000

With these little steps, you can run multiple agents on Different Kubernetes clusters and manage them(in the above example we were able to install server on Civo cloud and even connect GKE cluster). When I say manage them you can assign them to groups and create users for that. You can deploy the workloads from the Portianer UI

Creating team, users, Groups : With Portainer you can put clusters(endpoints) in different groups and assign user and team access. So create a team, create a user, create a new group, and team/user to that group, and then add cluster/endpoint to the new group. This way different users can assess different sets of clusters base on the need.

Creating Team:

Creating User:

Creating Group: In the endpoints section, create a new group.

Now once you have cluster added to a group, you can manage access as well as below:

Finally, Let us deploy a sample application to Civo cluster from Portainer.

Very easily you can define Image, Memory, CPU, NodePort and most of the customization and you can edit it on the fly from the UI.

Accessing application via NodePortAccessing application via NodePort

So with Portainer 2.0 you can import and manage multiple clusters and have them added to different groups as per the requirement of the teams or environments. Management is simple and so is the import cluster. Portainer with rich experience in Docker management now has a great release for Kubernetes management as well.

ENJOY PORTAINERING !!

Saiyam Pathak [CNCF Ambassador | CKA | CKAD ] Youtube Twitter

 
Share this