how to deploy kubernetes application in EKS through Jenkins

10/25/2019

I'm trying to deploy Kubernetes application in AWS EKS through Jenkins.

I visited few of blogs, they mentioned Jenkins X. But JenkinsX need to be configured separately. But as per instruction, we need to use our existing Jenkins for K8S app deployment.

Note : AWS EKS and Jenkins are Separate machine(We using our existing Jenkins). I may need to create New EKS environment based on requirement.

Please suggest if any AWS EKS plugin for Jenkins which can be used for deployment.

Else

Is there any way to create custom Bash script(automation script) for deploying K8S application in AWS EKS?

My Research here is : Actually AWS is providing api/sdk support for only Creating/Managing Clusters but not deploying the application in k8s environment(using kubectl).

Probably creating cluster we can do it through SDK. but How to deploy k8s application on remotely(because Jenkins is running in another machine).

-- Prakash26790
amazon-web-services
aws-eks
jenkins
kubernetes

2 Answers

12/10/2019

Finally I'm done this exercise by creating Bash automation script, following these steps:

  1. Created Docker image with application binary.

  2. Created EKS Cluster using eksctl create cluster <PARAM>, which creates EKS Control Plane and Worker nodes.

  3. Created Kubernetes Deployment File using Docker image and Deployed using kubectl apply <PARAM> commandline.

  4. Exposed the application using kubectl expose <PARAM> cli.

Latest Update From AWS EKS Service:

AWS recently announced AWS EKS Worker node creation support using AWS SDK. So now Creating EKS environment can be done using SDK itself.

-- Prakash26790
Source: StackOverflow

10/26/2019

Why not configuring kubectl for jenkins and deploy apps using kubectl apply deployment.yaml command?

Once you have kubectl config you can save it as secret text. I had an assignment for the interview and here is an example of such deployment: https://github.com/mtuktarov/hello

It uses shared lib: https://github.com/mtuktarov/hello-jenkins-lib

-- Marat
Source: StackOverflow