Install Jenkins X on AWS EKS cluster


This blog describes how to Install Jenkins X on AWS EKS cluster

Introduction

Jenkins X is an open-source tool that automates CI/CD workflow for cloud native apps on Kubernetes. It harnesses the power of Kubernetes and let its users use it without knowing internal working of Kubernetes. Jenkins X is a collection of some of the best of breed tools and microservices like Kubernetes, Tekton, Helm, Lighthouse, Terraform, Octant(UI), Hashicorp Vault, Kaniko, Grafana, Prometheus, kuberhealthy, etc.

Before we proceed, please follow the prerequisites blogs which I wrote earlier AWS-EKS-Cluster and How to create Github organization and bot user accounts.

Create Jenkins X cluster git repo

Jenkins X provides a cluster git repository template for managing Jenkins X configuration. To change anything in your Jenkins X cluster, open a pull request to this repository. Fork this repository to your GitHub organization account by clicking on this link.

The recommended approach to install Jenkins X is via terraform script that is provided by another git repository. Fork this repository into your GitHub organization account via this link.

Now clone this repository into your local and open the project via your favorite IDE.

cd terraform-aws-eks-jx/

Open outputs.tf file and modify below parameter vault_user_id:

sensitive: true

Also, open the variables.tf file and modify the following parameters:

cluster_name:

default: “my-eks-cluster”

profile:

default: “default”

node_group_disk_size:

default: “20”

vpc_name:

default: “my-eks-vpc-stack-VPC”

public_subnets:

default: [“192.168.64.0/18”, “192.168.0.0/18”]

private_subnets:

default: [“192.168.128.0/18”, “192.168.192.0/18”]

vpc_cidr_block:

default: “192.168.0.0/16”

is_jx2:

default: false

jx_git_url:

default: (your-cluster-git-repo(jx3-eks-vault)

jx_bot_username:

default: (your-new-bot-user)

create_eks:

default: false

create_vpc:

default: false

vpc_id: default: (vpc-id-of-eks-cluster)

nginx_chart_version: default: “3.12.0”

Save GitHub bot user token as an environment variable

export TF_VAR_jx_bot_token=<git-bot-user-token>

To initialize terraform

terraform init

To see potential changes made by Terraform

terraform plan

To execute the install

terraform apply

When prompted for provider.aws.region, enter the AWS region where your EKS cluster is provisioned. If the terraform apply command ran successfully then you will see similar output as below

Note: It can take up to 10 minutes to install Jenkins X.

Verify Jenkins X installation

jx ns jx
kubectl get es -A

Expected output:

Check all pods are running in jx namespace kubectl get pods -n jx

Expected output:

Another command to verify successful Jenkins X installation

jx verify install

Expected output:

To visualize Jenkins X installation and pipelines on UI, run this command. It will automatically open UI in a browser jx ui

Expected output:

Verify ingress is working. Replace <hook-jx…> below with the value of hook’s HOSTS.

kubectl get ing -A
curl -v http://<hook-jx…>/hook 

Expected output:

Troubleshooting Tips:

TIP #1 If kubectl get es -A gives 404 status error, it most likely means that the secret generation step in the boot log did not work. One way to re-generate secrets is by making a direct push to the main branch of the cluster git repo (not by creating a pull request).

To verify successful secret generation, check admin logs using the following command and select the latest log jx admin log

Expected output:

TIP #2

If ingress controller is not working curl -v http://<hook-jx…>/hook does not give a 200 status code then check your ingress controller pod (nexus-nexus-…) is running via kubectl get pods -n jx

Verify this ingress IP is same as Elastic Network Interface (ENI) public IPv4 of the Network Load Balancer (NLB) created during Jenkins X installation.

Conclusion

As you can see how easily we can tweak input variables as per our need in terraform script and run only one command (terraform apply) to create the entire Jenkins X cluster. Now we can import our application git repository to this Jenkins X cluster and can create multiple pipelines.

Learn about Rackspace Managed SQL Databases.

Learn about Rackspace Database Services.

Use the Feedback tab to make any comments or ask questions. You can also start a conversation with us.

post avatar
Bachu Paul

Share this information: