GithubHelp home page GithubHelp logo

f1n1sh3r / jenkins-docker-kubectl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cirolini/jenkins-docker-kubectl

0.0 0.0 0.0 12 KB

Jenkins container with docker and kubectl

Groovy 4.73% Dockerfile 95.27%

jenkins-docker-kubectl's Introduction

Jenkins docker container with docker and kubectl

This is a sample to use Jenkins in a Kubernetes CI/CD workflow to control your pipelines. Here you have a Docker container for Jenkins that have installed docker to build docker containers and kubectl to control your Kubernetes enviroment.

With this Jenkins you can build docker containers for your applications and put them in your Kubernetes enviroment.

Getting Started

To develop this project you need Docker and a minimum kubernetes enviroment like minikube.

To Build

To get a local version you need follow the steps:

$ git github.com/cirolini/jenkins-docker-kubectl
$ docker build -t jenkins-cicd .

To Run Local

$ docker run -p 8080:8080 jenkins-cicd

or to mount a volume:

$ docker run -v ./jenkins_home:/var/jenkins_home -p 8080:8080 jenkins-cicd

How install

Open a web browser in http://localhost:8080/

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                               NAMES
5ceb833c07cc        jenkins-cicd        "/usr/local/bin/jenk…"   About a minute ago   Up About a minute   0.0.0.0:8080->8080/tcp, 50000/tcp   vigorous_hofstadter

$ docker exec 5ceb833c07cc cat /var/jenkins_home/secrets/initialAdminPassword
025136ad4f5d42cda1102ecf93a73c7d

Install the suggested plugins e restart.

How Run in a Kubernetes cluster

$ kubectl apply -f https://raw.githubusercontent.com/cirolini/jenkins-docker-kubectl/master/k8s_jenkins.yaml

This will create a Persistent Volume, a Service and Deployment to run Jenkins. And will apply the rbac role to grant Jenkins permissions for cluster admin.

I recommend that you install a registry to, for this follow this command:

$ kubectl apply -f https://raw.githubusercontent.com/cirolini/jenkins-docker-kubectl/master/k8s_registry.yaml

Now you have a Registry, this is a repository for storing and distributing Docker images.

Check instalation

$ kubectl get pods
NAME                       READY     STATUS    RESTARTS   AGE
jenkins-5ccb4f9498-56svc   1/1       Running   0          5m
registry-95c457bdb-9frmt   2/2       Running   0          5m
kubectl exec jenkins-5ccb4f9498-56svc cat /var/jenkins_home/secrets/initialAdminPassword
33c7f2604a274647acb327b87dba6427

Example

This is a example of a project tha you can use in this Jenkins: https://github.com/cirolini/Docker-Flask-uWSGI

And here have a tutorial to implement this case: https://medium.com/@cirolini/entrega-continua-com-kubernetes-e-jenkins-84bd9834a749

jenkins-docker-kubectl's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.