Portainer for kubernetes in less than 60 seconds!!

Portainer is an open-source tool for Building and Managing docker environments with ease. It has been widely adopted by the community over time with over 2 billion downloads.

Guess what Portainer for KUBERNETES (beta edition) has been released and this is a really good deal out there for developers. In this post, we will discuss how to setup Portainer for kubernetes in less than 60 seconds using ARKADE.

ARKADE is another cool open source project created by Alex Ellis -> https://github.com/alexellis/arkade. This tool helps you install kubernetes application with a single install command and speeds up your development experience.

Prerequisite: 2 core 4gb Machine (for this tutorial we will use Centos system)

Kubernetes setup: Just to make things a little more interesting we will be spinning up a k3s cluster. k3s is a lightweight kubernetes certified distribution built by Rancher Labs (https://k3s.io/).

  • Log in to the instance and run the following command to setup k3s cluster
[root@Arkade ~]#   time curl -sfL https://get.k3s.io | sh -
[INFO]  Finding latest release
[INFO]  Using v1.17.4+k3s1 as releas
[INFO]  Downloading hash https://github.com/rancher/k3s/releases/download/v1.17.4+k3s1/sha256sum-amd64.txt
[INFO]  Downloading binary https://github.com/rancher/k3s/releases/download/v1.17.4+k3s1/k3s
[INFO]  Verifying binary download
[INFO]  Installing k3s to /usr/local/bin/k3s
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Creating /usr/local/bin/ctr symlink to k3s
[INFO]  Creating killall script /usr/local/bin/k3s-killall.sh
[INFO]  Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink from /etc/systemd/system/multi-user.target.wants/k3s.service to /etc/systemd/system/k3s.service.
[INFO]  systemd: Starting k3s
real 0m19.644s
user 0m0.860s
sys 0m0.712s

[root@Arkade ~]# k3s kubectl get nodes
NAME     STATUS   ROLES    AGE   VERSION
arkade   Ready    master   2m   v1.17.4+k3s1

Just one single command and you have a kubernetes cluster up and running.

Arkade installation: We will install Arkade, again with one simple command.

[root@Arkade ~]# time curl -sLS https://dl.get-arkade.dev | sudo sh
x86_64
Downloading package https://github.com/alexellis/arkade/releases/download/0.2.3/arkade as /tmp/arkade
Download complete.
Running with sufficient permissions to attempt to move arkade to /usr/local/bin
New version of arkade installed to /usr/local/bin
Creating alias 'ark' for 'arkade'.
real 0m3.320s
user 0m0.202s
sys 0m0.220s
[root@Arkade ~]# arkade version
           _             _
 __ _ _ __| | ____ _  __| | ___
/ _` | '__| |/ / _` |/ _` |/ _ \
| (_| | |  |   < (_| | (_| |  __/
\__,_|_|  |_|\_\__,_|\__,_|\___|
Get Kubernetes
 apps the easy way
Version: 0.2.3Git Commit: 2a5e2be91f260f2c2066576ff0ed029dc3521c67
Portainer Installation: Now let us install Portainer for kubernetes on the cluster that we just created using a simple arkade install command.
[root@Arkade ~]# time arkade install portainer
Using kubeconfig: /root/.kube/config
Node architecture: "amd64"
======================================================================== 
Portainer has been installed                                        ========================================================================
# Open the UI:
kubectl port-forward -n portainer svc/portainer 9000:9000 &
# http://127.0.0.1:9000
# Or access via NodePort on http://node-ip:30777
Find out more at https://www.portainer.io/
Thanks for using arkade!
real 0m3.939s
user 0m0.893s
sys 0m0.135s

THATS IT!! Portainer for kubernetes is installed in 27 SECONDS. Lets us deploy a sample application using Portainer to the k3s cluster.

Portainer UI:


portainer_first_screen

First screen where you just need to enter the password


connect_kuberentes_cluster

Connect the kuberentes cluster


image_3

Portainer gives you a nice dashboard view that makes it easy to manage for the developers.


image_4

Now let us make this tutorial more interesting and try to deploy a sample application on the k3s cluster using Portainer.

Go to applications session and fill the information as per below screenshot and click deploy:


image_5

The application gets deployed and you can access the application at

nodeip:nodePort

Also if you click on the application you can see the number of pods running, logs, events, etc from Portainer UI itself and you need not interact directly with kubectl commands.


image_6

Another sweet thing that you can do is if you go to click console after going into the application, you can directly go inside the container and run commands in the container shell from the Portainer UI and again you need not interact with kubectl commands for that.


image_7

There are lot of other features as well that you can explore but for this tutorial, we saw how to spin up a kubernetes k3s cluster and run Portainer via Arkade in less than 60 seconds.

Portainer on Katakoda:

If you do not have a VM you can also try this out on a Katakoda cluster (free kubernetes cluster) by going to https://www.katacoda.com/courses/kubernetes/playground and install Portainer via arkade command that we ran earlier:

curl -sLS https://dl.get-arkade.dev | sudo sh
arkade install portainer


image_8

Just with two commands, Portainer will be up and running and ready for experimentation. In order to access port 30777 in katakoda you can do as follows:


image_9

So in this tutorial, we saw how Portainer can be installed on kubernetes cluster in less than 60 seconds. So go ahead, play with it and send feedback to Portainer team.

Kudos to Portainer team!!

Saiyam Pathak

LinkedIn

Twitter

Source: Portainer for kubernetes in less than 60 seconds!!

Written by: Saiyam Pathak


Leave a comment!

All fields marked with an asterisk* are required.