Skip to content

Homework 3: CI CD, Kubernetes, and other components

ayushsanghavi edited this page Apr 6, 2022 · 21 revisions

CI/CD setup for existing project & Addition of MERRA data pane

Deploying Kubernetes on XSEDE Jetstream 👍


Installing Jenkins on XSEDE Jetstream Ubuntu 20.04 👍 (Amol Sangar)

HOW TO INSTALL

sudo apt update
sudo apt install openjdk-11-jdk
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins
  • Check Jenkins status
systemctl status jenkins
  • Open port
sudo ufw allow 8080
  • The user jenkins needs to be added to the group docker to successfully run docker commands:
sudo usermod -a -G docker jenkins
  • Check if user is added to the group
grep docker /etc/group
  • Restart Jenkins
sudo systemctl restart jenkins 

Dependent software (To execute shell commands)

sudo apt update
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
cat /etc/apt/sources.list.d/nodesource.list
sudo apt -y install nodejs
node  -v
  • NPM: sudo apt install npm

  • Python: already present on jetstream


OPTIONS TO CONNECT TO KUBERNETES THROUGH JENKINS

  1. Use Jenkins Kubernetes
  2. Use Ansible playbook
  3. Use Helm charts
  4. Handle shell scripts manually

2,3,4 requires ssh ing into the K8s master

References -

Continuous Integration and Continuous Deployment (Ayush Sanghavi):

Generalized stages for each microservices :

Created 5 new branches for CI :

Generalized stages

  • As soon as the developer makes changes, the hook will trigger the Jenkins pipeline and the respective stages will start. Firstly, for some services, local build will take place, once the dependencies are correctly installed, and the build is successful, for some services, unit testing will take place, new docker image will be built and published to docker hub. The pipeline will then checkout with the Ansible Deployment GitHub branch and deployed to kubernetes clusters.

  • All Deployment yml files in the branch Ansible-K8s-deployments

  • Created playbook yml files for each service

Deploying an Object Store service (Madhavan Kalkunte Ramachandra)

We are using [Zenko Cloudserver] (https://www.zenko.io/cloudserver/), an S3 compatible object store service.

Local installation using docker

To run with a file backend, run the following command:

mkdir -m 700 $(pwd)/dataPath
mkdir -m 700 $(pwd)/metadataPath
docker run -d --name s3server -e S3DATAPATH="$(pwd)/dataPath" -e S3METADATAPATH="$(pwd)/metadataPath" -p 8000:8000 scality/cloudserver

To run with an in-memory backend, run the following command:

docker run -d --name s3server -p 8000:8000 scality/cloudserver-latest

Accessing with AWS S3 CLI

Install AWS CLI from here

add the following into ~/.aws/creditials file

[default]
aws_access_key_id = accessKey1
aws_secret_access_key = verySecretKey1
region = us-east-1

After this, you can use the AWS CLI to access the local deployment of s3 using --endpoint=http://localhost:8000 option as follows:

aws s3 ls --endpoint-url http://localhost:8000

Deploying on Kubernetes (TBD)

References

Clone this wiki locally