sawkhaing / deploy-jenkins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploy Jenkins to AKS

For Manual Intervation

Helm install

curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm

Create Namespace

kubectl create namespace jenkins --dry-run=client -o yaml | kubectl apply -f -

Create Service Account

kubectl apply -f jenkins-sa.yaml

RBAC access to the cluster.

Install Jenkins with helm

If want to add more plugins in jenkins-values.yaml

installPlugins:
- kubernetes:3734.v562b_b_a_627ea_c
- workflow-aggregator:590.v6a_d052e5a_a_b_5
- git:4.13.0
- configuration-as-code:1569.vb_72405b_80249
- docker-plugin:1.2.10
- docker-workflow:528.v7c193a_0b_e67c
- ghprb:1.42.2

helm repo add jenkinsci https://charts.jenkins.io
helm repo update
helm install jenkins -n jenkins -f jenkins-values.yaml jenkinsci/jenkins

Jenkins default username "admin". After installed with helm, wait the jenkins pods to the running state.

For Jenkin Password

jsonpath="{.data.jenkins-admin-password}"
secret=$(kubectl get secret -n jenkins jenkins -o jsonpath=$jsonpath)
echo $(echo $secret | base64 --decode)

Jenkins URL

JENKINS_IP=$(kubectl get svc --selector=app.kubernetes.io/name=jenkins -n jenkins -o jsonpath="{.items[0].status.loadBalancer.ingress[0].ip}")
echo "Jenkins URL http://$JENKINS_IP"

For the Automation run from the Github Actions

Pass the environment variable to deploy jenkins in the desire AKS.

  • ARM_CLIENT_ID
  • ARM_CLIENT_SECRET
  • ARM_SUBSCRIPTION_ID
  • ARM_TENANT_ID
  • AZURE_CREDENTIALS
  • RESOURCE_GROUP
  • CLUSTER_NAME

About