Configuring a Jenkins Pipeline
To create a deployment pipeline, you must create and configure a Jenkins Agent that can trigger a Helm command and Kubectl commands on a target EKS cluster. This Agent should be available as a Docker container for any Jenkins deployment to use.
The following example shows how to configure a Docker container for a Jenkins Agent:
FROM ubuntu:20.04
# Curl and Debian stuff
RUN apt update && \
apt install --no-install-recommends curl -y && \
apt install --no-install-recommends apt-transport-https -y && \
apt install --no-install-recommends gnupg2 -y && \
apt install --no-install-recommends unzip -y
# Docker tools
RUN apt update && \
apt install --no-install-recommends docker.io -y && \
apt install --no-install-recommends docker-compose -y
# Kubectl
RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
RUN apt update && \
apt-get --no-install-recommends install -y kubectl
# Helm
RUN curl -s https://baltocdn.com/helm/signing.asc | apt-key add -
RUN echo "deb https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list
RUN apt update && \
apt-get --no-install-recommends install -y helm
# Aws-Cli
RUN curl -s https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip
RUN unzip awscliv2.zip && ./aws/install
# Mtx-Kubectl
WORKDIR /usr/bin
COPY --from=harbor.matrixx-services.com/matrixx/mtx-kubectl /go/bin/mtx-kubectl .
RUN chmod +x mtx-kubectl