Skip to content

Latest commit

 

History

History
95 lines (72 loc) · 2.79 KB

README.md

File metadata and controls

95 lines (72 loc) · 2.79 KB

End-to-End-DevOps-Project-Infra:

  • 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

Terraform components:

  • 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

Cloud Architecture - Page 1 (3)


Commands to run Terraform:

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"

Commands to connect the private-bastion to the GKE:

gcloud auth login
gcloud container clusters get-credentials <cluster_name> --zone <zone> --project <project_name>

Create jenkins slave image with all its dependances:

  • on dockerhub mariamkasssab/jenkins_slave:v3

Commands to run Ansible:

  • mkdir jenkins in the private-bastion

  • run from your PC

ansible-playbook playbook.yaml -e 'ansible_ssh_common_args="-o -<ProxyCommand>- "'  

Commands on the jenkins salve pod:

  • 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>

2


1


3


4


Ansible


image


image