简体   繁体   中英

Defining Kubernetes Replica Set/Deployment and services in Jenkins

I am trying to implement CI/CD pipeline using Kubernetes and Jenkins. Now I am exploring about the CI part using Jenkins file, SVN repository with Docker Hub. After pushing the Docker image into registry docker hub , I need to deploy this into a Kubernetes cluster having 3 cluster master and 15 worker machine/node.

When I am reading deployment into Kubernetes cluster I have several doubts:

Every deployment definition within the Jenkins is writes using the shell script. If I need to create my Deployment and Services for those deployments, How I can define in Jenkins? Where I can create the YAML/YML files for ReplicaSet, Deployment and Services? Do I need to use shell scripting for this? Or in any other method?

You can use Kubernetes Helm to define what you want to spin up, in parameterisable modules called Helm charts. Many charts are available for common software like nginx and postgresql. This allows an "infrastructure as code" way of working - declaratively specifying what you want, instead of using a script to manually get the cluster into the desired state from whatever state it is currently in, just rely on Helm to do that for you! This is a good use case for Helm.

We're working on an open source project called Jenkins X which is a proposed sub project of the Jenkins foundation aimed at automating CI/CD on Kubernetes using Jenkins pipelines and GitOps for promotion across environments.

If you want to see how to automate CI/CD with multiple environments on Kubernetes using helm for package management, GitOps for promotion between environments and Preview Environments on Pull Requests you might wanna check out my recent talk on Jenkins X at DevOxx UK where I do a live demo of this on GKE. Though Jenkins X works on AWS, AKS and GKE and other kubernetes clusters too .

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