This repository contains a demo project created as part of my DevOps studies in the TechWorld with Nana – DevOps Bootcamp.
Demo Project: CD - Deploy to DigitalOcean Kubernetes cluster from Jenkins Pipeline
Technologies used: Kubernetes, Jenkins, DigitalOcean Kubernetes, Docker, Linux
Project Description:
- Create K8s cluster on DigitalOcean
- Install
kubectlas Jenkins Plugin - Adjust
Jenkinsfileto use Plugin and deploy to DigitalOcean Kubernetes cluster
-
Create a minimal Kubernetes cluster with 1 node in the DigitalOcean console.
-
Download the kubeconfig file and set it as your active context:
export KUBECONFIG=k8s-kubeconfig.yaml
-
Go to Dashboard → New Item.
-
Name it
k8s-digital-ocean, select Multibranch Pipeline, and click OK. -
Under Branch Sources, click Add source → GitHub and fill in:
Field Value Credentials githubRepository HTTPS URL https://github.com/explicit-logic/eks-module-11.5Click Validate to confirm access.
-
Under Behaviors, click Add and enable:
Discover branches
-
Under Build Configuration, set:
- Script Path:
Jenkinsfile
- Script Path:
-
Click Save — Jenkins will scan the repository and create a job for each branch.
-
Navigate to
k8s-digital-ocean→ Credentials → Global → Add Credentials. -
Select Secret file as the credential type.
-
Upload the kubeconfig file of your DigitalOcean K8s cluster.
-
Set the ID to
digitalocean.
-
Navigate to Manage Jenkins → Plugins → Available plugins.
-
Search for
Kubernetes CLIand install it. -
Restart Jenkins to complete the installation.
Note: SSH into the Jenkins server and start the Jenkins container again if running in Docker.
-
Retrieve the
serverUrlfrom your kubeconfig file:clusters→cluster→server. -
Add the following deploy stage to your
Jenkinsfile:stage('deploy') { steps { script { echo "deploying docker image..." withKubeConfig([credentialsId: 'digitalocean', serverUrl: params.SERVER_URL]) { sh 'kubectl create deployment nginx-deployment --image=nginx' } } } }



