简体   繁体   中英

how to deploy kubernetes application in EKS through Jenkins

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).

Look at kubernetes-cd plugin. Follow the link https://github.com/jenkinsci/kubernetes-cd-plugin

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

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.

===================

Update:

Now AWS has Supported Creating worker node thorugh UI and AWS SDK. https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/EKS.html#createNodegroup-property

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM