Issue
We are moving EC2-backed Jenkins to Amazon EKS[Elastic Kubernetes Service] & EFS[Elastic File System] backed Jenkins. I have deployed Jenkins in EKS machine and it's opening and working fine. But to run our pipeline we need to install Python and AWS CLI in the slave node. But we don't know where and how to install them. Any help would be highly appreciated.
Solution
As ycr mentioned, I have created my own custom image using the base slave image. I also followed the documentation provided by Jenkins Link. My Custom Docker image:
FROM jenkins/inbound-agent:4.11.2-4
USER root
RUN apt-get update && apt-get install python3-pip toilet curl awscli jq -y && pip install --upgrade pip
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz \
&& tar xzvf docker-20.10.9.tgz \
&& mv docker/docker /usr/local/bin \
&& rm -r docker docker-20.10.9.tgz
RUN pip install boto3 pyaml
RUN apt install amazon-ecr-credential-helper -y
COPY . /.
Here I have created .docker folder which contains the config.json file which I'm copying to the root directory of Jenkins slave. It is required if we don't want to provide ECR credentials every time. More details about ECR Credential helper is in this Link
Answered By - Deepakvg
Answer Checked By - Senaida (JavaFixing Volunteer)