在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):eldada/jenkins-in-kubernetes开源软件地址(OpenSource Url):https://github.com/eldada/jenkins-in-kubernetes开源编程语言(OpenSource Language):Dockerfile 43.0%开源软件介绍(OpenSource Introduction):Jenkins in KubernetesThis repository has a This Jenkins has the required tools to work in and with Kubernetes
IMPORTANT: This example is for demo and testing. It should not be used a production environment! Get the example Docker imageYou can pull an already built version of this Jenkins image from bintray.com. # Pull the image
docker pull eldada-docker-examples.bintray.io/jenkins:lts-k8s-20190827 Build the Jenkins Docker imageYou can build the image yourself export DOCKER_REG=SET_YOUR_DOCKER_REGISTRY_HERE
# Build the image
docker build -t ${DOCKER_REG}/jenkins:lts-k8s .
# Push the image
docker push ${DOCKER_REG}/jenkins:lts-k8s Test your imageYou can run your container locally, if you have Docker installed
# Run the container you built before
docker run -d --name jenkins -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock eldada-docker-examples.bintray.io/jenkins:lts-k8s-20190827
# Run the container you built before
docker run -d --name jenkins -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock ${DOCKER_REG}/jenkins:lts-k8s
Deploy Jenkins helm chart to KubernetesIf you are using the pre-built image # Init helm and tiller on your cluster
helm init
# Deploy the Jenkins helm chart
# (same command for install and upgrade)
helm upgrade --install jenkins ./helm/jenkins-k8s NOTE: This helm chart deploys a pod with two containers. One for the Docker daemon and another for Jenkins. This is based on the suggestion in https://applatix.com/case-docker-docker-kubernetes-part-2/ If you are building your own version of Jenkins, you need your Kubernetes cluster to be able to pull the Docker image.
You have to create a Docker registry secret and reference to it in your # Create a Docker registry secret
export DOCKER_REG=SET_YOUR_DOCKER_REGISTRY_HERE
export DOCKER_USR=SET_YOUR_DOCKER_USERNAME_HERE
export DOCKER_PWD=SET_YOUR_DOCKER_PASSWORD_HERE
export DOCKER_EML=SET_YOUR_DOCKER_EMAIL_HERE
kubectl create secret docker-registry docker-reg-secret \
--docker-server=${DOCKER_REG} \
--docker-username=${DOCKER_USR} \
--docker-password=${DOCKER_PWD} \
--docker-email=${DOCKER_EML}
# Deploy the Jenkins helm chart
# (same command for install and upgrade)
helm upgrade --install jenkins \
--set imagePullSecrets=docker-reg-secret \
--set image.repository=${DOCKER_REG}/jenkins \
--set image.tag='lts-k8s' \
./helm/jenkins-k8s Data persistenceBy default, in Kubernetes, the Jenkins deployment uses a persistent volume claim that is mounted to VagrantYou can test your Docker image using
# Spin up the Vagrant VM
vagrant up
# SSH into the VM
vagrant ssh
# Go to the mounted sources repository
cd /opt/provisioning
# Build and run your Jenkins container as shown above
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论