- The project is about creating a private cluster and deploying Jenkins, and deploying as an app using the Jenkins pipeline.
- I used a google cloud provider, created the infra using Terraform, and deployed Jenkins on the GKE using Ansible.
- The Infra repo
- The APP repo
- VPC
- Two subnets one for GKE and the other for the private-bastion
- GKE cluster
- IAP
- NAT Gatway and Router
- Service Account
- private-bastion wuth its automation file
terraform init
terraform plan
terraform apply
- run
gcloud compute ssh private-bastion --dry-run private-bastion
to get the "ProxyCommand" - run
ssh-keygen -t rsa
to generate a keypair - then ssh to the private-bastion
- copy the pub key and paste it in the private-bastion in path: "/home/user/.ssh/authorized_keys"
gcloud auth login
gcloud container clusters get-credentials <cluster_name> --zone <zone> --project <project_name>
- on dockerhub
mariamkasssab/jenkins_slave:v3
-
mkdir jenkins
in the private-bastion -
run from your PC
ansible-playbook playbook.yaml -e 'ansible_ssh_common_args="-o -<ProxyCommand>- "'
passwd jenkins
to reset the password we will use on jenkins.chmod 777 /var/run/docker.sock
service ssh start
- then,
gcloud auth login
gcloud container clusters get-credentials <cluster_name> --zone <zone> --project <project_name>