Skip to content
/ Devops04 Public

Devops04 - CI/CD with Jenkins and Kubernetes

License

Notifications You must be signed in to change notification settings

c4xp/Devops04

Repository files navigation

Devops04 - Jenkins and Kubernetes

Hits DockerStars

Introduction

English | Romana

What we cover

  • Docker build
  • Simple Kubectl Deploy
  • Jenkins Deploy

System Requirement

System Requirement to install this repository are as following:

Conditions Details Notes
Operating System Windows Pro, CentOS7.x, Ubuntu20.04 Docker Desktop see-Devops01
Cloud Azure, Aws, Bare-metal, Rancher, VirtualBox Kubernetes cluster
Machine Configuration vCPU no less than 2 core, Memory no less than 4 GIB, Storage no less than 20 GB, Swap no less than 2GB Bandwidth no less than 100M

Ecosystem

Core components of this repository: Jenkins, Docker, Rancher

Installation on Synology

Synology-diskstation

Installing Docker onto a Synology NAS is the normal click click click sort of workflow.

Docker-pkg

Step 1: Prepare Synology

Synology HDD compatibility How to Install XPEnology Tinycore Redpill

The first thing to do is to enable SSH login on Diskstation. To do this, go to the “Control Panel” > “Terminal”

Synology-ssh

After that you can log in via “SSH”, the specified port and the administrator password (Windows users take Putty or XShell or mRemoteNG).

I log in via Terminal, winSCP or Putty and leave this console open for later. Optionally you can login directly with Windows OpenSSH client: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui

The authenticity of host '[synology.local](0.0.0.0)' can't be established.
ECDSA key fingerprint is SHA256:1234567890abcdef1234567890abcdef1234567890a.
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password: ********
[email protected]:~$

Step 2: Prepare Docker folder

I create a new directory called “jenkins” in the Docker directory, as well a a “docker-compose.yml” file.

mkdir -p /volume1/docker/jenkins/
cd /volume1/docker/jenkins
touch docker-compose.yml
mkdir -p data

Docker Compose file contains:

version: '2.0'
services:
  jenkins:
    restart: always
    image: jenkins/jenkins:lts
    privileged: true
    user: root
    ports:
      - 8081:8080
    container_name: jenkins
    volumes:
      - ./data:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/local/bin/docker:/usr/local/bin/docker

Step 3: Start

I can also make good use of the console in this step. I start the Jenkins server via Docker Compose.

sudo docker-compose up -d

Synology-docker

After that I can call my Jenkins server with the IP of the diskstation and the assigned port from “Step 2”.

Jenkins-login

Enter the password that we captured from the file at /var/jenkins_home/secrets/initialAdminPassword after installing Jenkins.

Jenkins-initial

Plugins

I recommend just installing the recommended plugins first up. You can always add or remove plugins later.

Jenkins-plugins

Some plugins to install:

Some plugins to remove (if not needed):

Docker engine inside Jenkins container

Enter the container

docker exec -it jenkins /bin/bash

Get the random admin password generated

cat /var/jenkins_home/secrets/initialAdminPassword

How to install Docker engine inside Jenkins Debian container

apt-get update
apt-get install ca-certificates curl gnupg lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

service docker start
docker run hello-world

Some investigations inside the container

docker run busybox ping -c 1 192.203.230.10
docker run busybox nslookup google.com

Questions

Git→

About

Devops04 - CI/CD with Jenkins and Kubernetes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published