We Will Be Using
We Will Be Using
We Will Be Using
GitHub
Jenkins
Docker
Ansible
Minikube for Kubernetes
Pre-Requisites:
3 EC2 Instances
Jenkins (Default-jre+jenkins) (all traffic allow)(t2 micro)
Ansible (python+ansible+docker) (all traffic allow)(t2 micro)
WebApp(kubernetes cluster) → (docker+minikube)(t2 medium)(all
traffic allow)
Prerequisites:
To begin this project, ensure that you have the following components
and configurations in place:
a. Jenkins: Use a t2.micro instance with the default JRE and Jenkins
installed. Allow all traffic.
After installing Jenkins, access it using the public IP with port 8080 in
your web browser.
cat /var/lib/jenkins/secrets/initialAdminPassword
Create a bash script file named ansible.sh using the command nano
ansible.sh.
node {
stage('Git Checkout'){
git ' https://github.com/AWSENG/Kubernetes_Project'
}
}
Apply and save the pipeline configuration. Trigger the Jenkins job by
clicking the ‘Build Now’ option. You will see the execution status, and if
it succeeds, the pipeline has been executed successfully.
Get back to your Jenkins server and run this command with your
pipeline project name to see the project.
To automate the process using a webhook, follow these steps:
2.Check the box for “GitHub hook trigger for GITScm polling”.
docker images
Do addition of this script as well. After adding this stage, save the
pipeline configuration. Full Groovy Script.
After saving, you can access the full Groovy script at this link: Full
Groovy Script.
SSH into the Ansible server and Execute the following command:
docker login
vi /etc/ssh/sshd_config
Uncomment the lines containing the following configuration
settings: PermitRootLogin yes PasswordAuthentication yes
Save the changes and exit the file and Restart the SSH service to apply
the modifications:
[node]
IP of k8S server
vi /etc/ansible/hosts
Now to check if it succeed run this command if ping success
To generate the pipeline syntax for the K8s server, choose the SSH
agent and SSH username with a private key, and fill in the other
necessary details.