Devops
Table of Content:
Table of Content:
Step by step Implementation:
Part 1:
Screenshots:
OS version:
Minikube version:
Kubectl version:
Docker version:
Pod info:
Services info:
Deployment info:
Nodes info:
Part 2:
Part 3:
Screenshots of Important Steps:
Minikube installation:
Docker Build locally:
Tested locally:
Running successfully:
Building Image on Docker Hub:
Running image on docker hub:
Part 4:
Screenshots:
Connecting to remote and adding code:
Origin pushed to main:
Part 5:
Created Deployment.yml:
Created Services.yml:
Part 6:
Starting Minikube:
Part 7:
Pushing image to docker Hub:
Part 8:
Download self-hosted Runner:
Deploy.yml:
Part 9:
Trigger local deployment:
Minikube service freelance-service -n freelance:
Automated workflow and deploy:
-
Errors Screenshots:
ClusterIP not exposed error:
Solution:
Service Invalid:
Solution:
Service not available:
Solution:
Workflows Automation Error:
Solution:
Docker login Error in Automated Deploy.yml:
Solution:
Commands Used:
-
Github repository link:
https://github.com/Waheed-Gulzar/SCD.git
Video link:
https://drive.google.com/file/d/1UwDEQv7aPr02jvqh8sTh_wz20EL7Vzo8/view?usp=sharing
Step by step Implementation:
Part 1:
We installed the minikube and kubectl on the system
Screenshots:
OS version:
Minikube version:
Kubectl version:
Docker version:
Pod info:
Services info:
Deployment info:
Nodes info:
Part 2:
We took an existing web project with frontend backend and PostgreSql as Database.
Part 3:
We built the image locally and on docker hub, ran and tested.
Screenshots of Important Steps:
Minikube installation:
Docker Build locally:
Tested locally:
Running successfully:
Building Image on Docker Hub:
Running image on docker hub:
Part 4:
In this part code is pushed to the github repository.
Github repository link:
https://github.com/Waheed-Gulzar/SCD.git
Video link:
https://drive.google.com/file/d/1UwDEQv7aPr02jvqh8sTh_wz20EL7Vzo8/view?usp=sharing
Screenshots:
Connecting to remote and adding code:
Origin pushed to main:
Part 5:
Created Deployment.yml:
Created Services.yml:
Part 6:
Starting Minikube:
Part 7:
Pushing image to docker Hub:
Part 8:
Download self-hosted Runner:
Deploy.yml:
Part 9:
Trigger local deployment:
Minikube service freelance-service -n freelance:
Automated workflow Trigger and deploy:
Errors Screenshots:
ClusterIP not exposed error:
Solution:
To solve this problem we added the nodeport:30036 to service.yml
Service Invalid:
Solution:
spec:
type: NodePort
Specification type added and the type is NodePort
Service not available:
Solution:
Added the database url to freelance secret.
Applied all changes to the file.
Workflows Automation Error:
eval $(minikube docker-env)
Solution:
Actually we were using windows and on windows
Command: eval $(minikube docker-env)
Does not work here
We need to run this command on powershell
& minikube -p minikube docker-env --shell powershell | Invoke-Expression
Docker login Error in Automated Deploy.yml:
There was a docker login error.
Reason was this command in Deploy.yml
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{secrets.DOCKER_USERNAME
}}" --password-stdin
Solution:
We changed this command to
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}"
Commands Used:
Commands
Brief Description
Minikube version
To check the version of Minikube
Kubectl version –client
To check the version of the Kubectl
docker build -t freelance:latest .
Used to build the image locally
docker run -p 5000:5000 freelance
Used to Run and test locally
git remote add origin URL
Used to connect the local repo with the remote
repository.
Git add .
Add all the files to stage
git commit -m “Message”
This commits the files to the remote repository
with a message.
Git push origin main
This pushes the origin back to main.
Minikube start
This starts the minikube which is installed on the
local machine
& minikube -p minikube docker-env --shell
powershell | Invoke-Expression
This ensures that the docker images are built
inside the minikube environment.
kubectl apply -f deployment.yml
--namespace=freelance
kubectl apply -f service.yml
--namespace=freelance
kubectl get all --namespace=freelance
minikube service freelance-service
--namespace=freelance
kubectl get pods -n freelance
kubectl describe pod
freelance-deployment-7fc74bff5d-f76z6 -n
freelanc
kubectl apply -f deployment.yml
kubectl get nodes -o wide
kubectl get deployments -n freelance -o wide
kubectl get svc -n freelance -o wide
docker push waheedgulzar51/freelance:latest
docker login -u waheedgulzar51