Infra As Code — Terraform (4) Deploy Kubernetes Dashboard and Jenkins App

In my last article, I showed you how to deploy worknodes to your AWS EKS cluster. If you followed my article (Infra As Code — Terraform (3) Add Worknodes To AWS EKS Cluster), you should have a EKS cluster and one running worknode.

Before you deploy anything, it is important to build a visual dashboard for you Kubernetes platform, so that you can have one place to go to observe and check your platform status. I will talk about Kubernetes dashboard and how to deploy it in this article. You can definitely use kubectl to get the platform information, but that’s not very user friendly and won’t give you the best experience. I will also do one example (Jenkins) application deployment.

What Is Kubernetes Dashboard and Why You Need It?

In one sentence, Kubernetes Dashboard is a general purpose, web-based UI for Kubernetes clusters. Use Kubernetes dashboard, you can manage the cluster resources, deploy applications to the cluster and troubleshoot your containerized applications. Dashboard is a good place to get an overview of your cluster. For example:

How To Deploy Kubernetes Dashboard?

Assuming you already installed and configured kubectl (If not, you can refer to this documentation (How to install kubectl):

  1. Deploy kubernetes metrics server. Metrics server is an aggregator of all the resource usage data, this is not included in the EKS default deployment. Kubernetes cluster will use the metrics server to gather data.
# Check cluster info
$ kubectl get svc
kubernetes ClusterIP <none> 443/TCP 56m
$ kubectl get node
ip-10-0-0-251.ec2.internal Ready <none> 51m v1.15.11-eks-af3caf
# Deploy the Metrics server
$ kubectl apply -f created created created created
serviceaccount/metrics-server created
17 apiVersion: v1
deployment.apps/metrics-server created
service/metrics-server created created created
(awscli) txu@tmac  /tmp  kubectl get deployment metrics-server -n kube-system
# Verify metircs-server deployment is running
$ kubectl get deployment metrics-server -n kube-system
metrics-server 1/1 1 1 12s

2. Deploy the dashboard

$ kubectl apply -f
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created created created created created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created

3. Create an admin account. For security reasons, the Kubernetes dashboard user has limited permissions. For demostration purpose, we will create an eks-admin service account and cluster role binding, so we can securely connect to the dashboard with admin access. You can use Role-based access contorl (RBAC) to get more granular level access control.

# Create the admin service account YAML file
$ vim eks-admin-svc-account.yaml
apiVersion: v1
kind: ServiceAccount
name: eks-admin
namespace: kube-system
kind: ClusterRoleBinding
name: eks-admin
kind: ClusterRole
name: cluster-admin
- kind: ServiceAccount
name: eks-admin
namespace: kube-system
# Apply the service account and cluster role binding
$ kubectl apply -f eks-admin-service-account.yaml
serviceaccount/eks-admin created created

4. Now the dashboard is deployed and admin service account has been created, it is time to connect! We need an an authentication token for the eks-admin service account. This can be generated by the following command:

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}')
Name: eks-admin-token-f2ncf
Namespace: kube-system
Labels: <none>
Annotations: eks-admin 4fbd22a2-5281-4e40-950f-673b40f59696
ca.crt: 1025 bytes
namespace: 11 bytes
token: xxxxxx

Now start the proxy service:

$ kubectl proxy
Starting to serve on

Connect to the dashboard by typing the following url in your browser:


Choose “Token” and input the token:

Click “Sign in”, and you should be able to see the dashboard!

Use Kubernetes Dashboard To Deploy Jenkins Application

Now the dashboard is up and running, let’s use it to deploy a Jenkins application. You can see how easy it is to deploy apps using the Dashboard!

  1. Go to kubernetes dashboard, and click the “+” sign on the upper right corner.
  2. Choose “Create from form”

3. Click “Deploy”, you will see the deployment is ongoing immediately:

4. Wait till the deployment finishes:

5. Now go to the “External Endpoints” of your Jenkins app:

6. You should see your Jenkins app is up and running:

7. You can use kubectl get the the password:

$ kubectl get pods
jenkins-c595699-pkjxr 1/1 Running 0 5m13s
$ kubectl logs jenkins-c595699-pkjxr
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
143365d1fa034537817b5ec0f81a951e (The password)This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

After fill in the password, you are all set!

I hope you enjoyed my article and was able to get your own first containerized app deployed into your EKS cluster!




Senior Cloud Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Data Model Meets World, Part II: Identity Crisis

Flash Stock Rom on Bedove i5b single core

Flash Android phone

Creating a RTS-like minimap with Unity

Scaling engineering teams

A team at work

What is Curl in Linux, How to use? | Linux Tutorial

Open Source contribution -How to start and is there any advantage

Creating a Button to insert Records into an Access Database with VBA.

map & mutex vs sync.Map

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Senior Cloud Engineer

More from Medium

Running Kubernetes clusters on Amazon Elastic Kubernetes Service using Spot Instances with Cloud9…

Introduction to Kubernetes for application developers

Learn Kubernetes: Ingress — Use Ingress

Build Docker Image In Kubernetes Pod —