Jenkins enviroment installation on Azure
1)Install jenkins:
https://docs.microsoft.com/en-us/azure/developer/jenkins/configure-on-linux-vm
in vm creating part use this:
az vm create \
--resource-group QuickstartJenkins-rg \
--name QuickstartJenkins-vm \
--image UbuntuLTS \
--size Standard B2s \
--admin-username "azureuser" \
--generate-ssh-keys \
--custom-data cloud-init-jenkins.txt
in artice use other vm which is cost higher than B2s , but i am using B2s it works very well
2)Install docker:
https://docs.docker.com/engine/install/ubuntu/
Then give permission to docker.sock for build image:
Recommend way second one:
sudo chmod 776 /var/run/docker.sock // for all
sudo chown $USER /var/run/docker.sock // for current user
3)Install openjdk11 for build process, because our spring projects on jdk11
sudo apt install openjdk-11-jdk -y
sudo update-alternatives --config java , then click enter for selecting *
and configure openjdk11 in jenkins global tool configuration
for further information about jenkins:
https://www.youtube.com/watch?v=LFDrDnKPOTg&list=PLEiEAq2VkUUJS6zkGgXeWw9l32EwRoYdR&index=13
https://www.youtube.com/watch?v=QaDNk1a8xFU&list=PLEiEAq2VkUUJS6zkGgXeWw9l32EwRoYdR&index=21
https://www.youtube.com/watch?v=-GsvomI4CCQ&list=PLEiEAq2VkUUJS6zkGgXeWw9l32EwRoYdR&index=22
Extra things:
1) Multibranch pipeline trigger with github webhooks:
https://valaxytech.medium.com/multibranch-pipeline-on-jenkins-with-webhook-a65decede4f8
https://www.youtube.com/watch?v=fo36b23cpIU
2) Push images to dockerhub from jenkins:
https://medium.com/codex/how-to-push-a-docker-image-to-docker-hub-using-jenkins- 487fb1fcbe25
3) Deploy to GKE:
install kubectl in Jenkins vm : https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
configure Google Kubernetes Plugin: https://www.youtube.com/watch?v=bGCHHi-As9M
repo in above video : https://github.com/amit873/Jenkins-Docker-Kubernetes-Project3
*Additional info about GKE enviroment:
configure ingress-nginx for routing:
https://cloud.google.com/community/tutorials/nginx-ingress-gke
static-ip config for ingress-nginx load balancer:
gcloud compute addresses create ingress-nginx-static-ip --region us-central1 - create static ip for ingress-nginx
gcloud compute addresses list - show static ip address list
kubectl patch svc nginx-ingress-ingress-nginx-controller -p '{"spec": {"loadBalancerIP": " 35.239.165.176"}}' - changing load balancer ip to static
Comments
Post a Comment