Deploy Rundeck on AWS EKS
Deploy Rundeck on AWS EKS
Amazon Elastic Kubernetes Service (Amazon EKS) is a fully-managed Kubernetes service that simplifies the process of building, securing, operating, and maintaining Kubernetes clusters on AWS. Amazon EKS automatically manages the Kubernetes nodes, containers, application availability and stored cluster data.
Deploying Rundeck on EKS takes advantage of Kubernetes capabilities such as auto-scaling, portability and availability. This makes it a strong choice for cloud deployments. Consequently, it’s common to see Rundeck implemented on Kubernetes clusters.
This guide explains how to configure different tools that interact with the AWS EKS and how to deploy a basic Rundeck (or commercial Runbook Automation) deployment on an AWS EKS Cluster.
Requirements
AWS
- A valid AWS account with sufficient access rights to create EKS clusters.
- AWS CLI, a tool to interact with the AWS resources. Check the most recent version and instructions for installing it for your OS system here.
- K9S, a tool for monitoring and interacting Kubernetes pods easily, recent version and installation instructions here.
Kubernetes
- Kubectl, the command line tool for working with Kubernetes clusters. Find installation instructions here.
- EKS CTL, the command line tool for working with EKS clusters that automates many individual tasks. Find installation instructions here.
- K9S, for monitoring the EKS cluster. This is optional but useful. Learn how to install it on your operating system by visiting this page.
Environmental Setup
Configure the AWS CLI tool with the following command
aws configure
When prompted, provide the AWS access and secret key.
Create the EKS cluster
EKS CLI is linked to AWS CLI. If AWS CLI was configured successfully in the previous step, create an EKS cluster with the following command.
eksctl create cluster --name oss-test-cluster --version 1.23 --region eu-north-1 --nodegroup-name test-workers --node-type t3.xlarge --nodes 3 --nodes-min 1 --nodes-max 4 --managed
Included parameters:--name
: The cluster name.--version
: The Kubernetes version. Where possible, use the latest version.--region
: AWS region where the cluster is deployed. The example uses eu-north-1
(Stockholm).--nodegroup-name
: The node group name. One or more Amazon EC2 instances deployed in an Amazon EC2 Auto Scaling group are referred to as a node group.--node-type
: C2 image type. It is crucial to pick a type with enough resources to run.--nodes
: The number of worker nodes (node groups).--nodes-mi
: Minimum number of workers (node groups).--manage
: Creates managed nodes to use AWS EC2 instances-based nodes, managed nodes are provisioned Amazon EC2 machines that offer Auto Scaling capabilities that are managed by Amazon EKS.
Configure kubectl
to interact with the AWS EKS cluster
Enter the following AWS CLI command:
aws eks update-kubeconfig --region eu-north-1 --name oss-test-cluster
Creating the Rundeck namespace
To avoid interfering with other services, best practice is to create a different namespace than the default
namespace. This example used the bangarang
namespace for the deployment.
Create a bangarang
namespace:
kubectl create namespace bangarang
Set the custom namespace as the default namespace
Set the bangarang
namespace as the kubectl
default:
kubectl config set-context --current --namespace=bangarang
This should be reflected by oss-test-cluster
(bangarang
namespace) using k9s
Deployment
Deploying the Rundeck service
Create a text file named rundeck-svc.yaml
:
apiVersion: v1
kind: Service
metadata:
name: rundeck-svc
labels:
env: dev
spec:
type: LoadBalancer
ports:
- port: 4440
selector:
env: dev
Deploy the service using the .yaml file:
kubectl apply -f rundeck-svc.yaml
Check service availability:
kubectl get service
Result should look like this:
Note: The "EXTERNAL-IP" column is the Service URL for the Rundeck deployment. Copy it for use in the next step.
Deploying Rundeck to EKS
Create a text file named rundeck-deployment.yaml
:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rundeck
labels:
env: dev
spec:
replicas: 1
selector:
matchLabels:
env: dev
template:
metadata:
labels:
env: dev
spec:
containers:
- name: rundeck
image: rundeck/rundeck:4.8.0
env:
- name: RUNDECK_GRAILS_URL
value: "http://service_url:4440"
ports:
- containerPort: 4440
Note: http://service_url:4440
is the URL taken from the service URL. Use this URL to access the Rundeck instance.
Deploy Rundeck in the EKS:
kubectl apply -f rundeck-deployment.yaml
The deployment should look as follows in k9
:
Rundeck is available via the service's external URL.
Uninstalling
To uninstall the Rundeck deployment use:
kubectl delete deployment rundeck-deployment
Destroy the Service with:
kubectl delete service rundeck-svc
Resources
- AWS EKS Introduction
- AWS CLI Documentation
- EKS CTL Getting Started
- Kubectl Getting Started
- Rundeck K8s examples (DockerZoo)