Mlops Basics-Integration of Jenkins with K8’s and ML

Jaindivya
4 min readJul 9, 2021

We are done with the connection of K8’s with Jenkins

So Now our first step will be we will create a document and will go inside it

Step2:

>>Initialize the git by using the git init command

>>Set the branch as master

>>add your git remote origin

I just created a sample text doc to see if everything is working fine

>>Now add the current dir that is test.txt

>>Use git commit and commit your file

>>Push it in the master branch

Wohooo…Your test.txt is committed

>>Your next step would be add the .pk1 file of your model in the same folder

>>again add this in our git repo

>>Now commit the current .pk1 file

>>push the file in the repo

>>Go to Jenkins and do the following configurations :

>>Create a new freestyle job and in SCM , click the Git option and write the URL of your Repository

Following is my markscode.py file

I ll do the same procedure of add, commit and push with the markscode.py file too

As you can see in your workspace, All the files are present

>>Next step would be to create a Dockerfile ,

And create the Dockerfile in you local Vm as well where jenkins is running in / drive

This is the Dockerfile.

Now, check the status,

You will see that the file is saved as Docker.txt, but this is a Dockerfile so it shouldn’t be in text format to save this as a Dockerfile in windows use “ ” double quotes while saving

Now this will be saved as Dockerfile

Do the necessary git configurations as required

Build the Job again and now Dockerfile will be available in jenkins workspace

Now in the execute shell follow the steps given below to build docker image from the Dockerfile

We used sudo and jenkins is a user and it don't have that much power

VOila!!! Our image is running successfully inside Jenkins

>>Now you have to tag this image with your docker hub username so as to you can upload your image in dockerhub

>>So we renamed it as my image name

divyajain202/mlopsproj:v1

>>Push the docker image in dockerhub

This is achieved successfully

Your image is there in the dockerhub!!

Now create a k8’s deployment with your own ML image that you created just now

Add the kubectl command as shown below

Finally k8’s deployment is created

Voila !! We have achieved this

My DockerImage=divyajain202/mlopsproj

Github link:https://github.com/Divya-2001/mymodelws.git

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response