Prepare the kubernetes cluster on AWS using terraform :
- connect to terraform server
1.install kubectl install aws-iam-authenticator install eksctl
-
copy vpc.tf and bucket.tf (includes EKS configuration) to your terraform server , and run "terraform apply"
-
wait for the deployment to finish.
-
when it's done run the following commands :
"aws eks --region eu-central-1 update-kubeconfig --name terraform-eks-demo"
"terraform output config_map_aws_auth >> aws-auth-cm.yaml"
"kubectl apply -f aws-auth-cm.yaml"
-
wait for all the kuberenetes nodes to come up using : kubectl get nodes --watch
-
copy the follwoing yaml files into the server : jenkins-deployment.yaml , jenkins-service.yaml .
-
run the following commands : kubectl create -f jenkins-deployment.yaml kubectl create -f jenkins-service.yaml
-
wait for the jenkins deployment to be ready .
-
connect to jenkins and configure it with admin user and add docker plugin.
-
connect Jenkins to github repository via webook to pull the source code and the docker file.
-
copy the file called deployment.yaml to your server (the one which we will be using to deploy the app itself)
-
copy the jenkinsfile into jenkins , it will pull the source code + the dockerfile and build it , afterwards it will push it to docker registry and finally it will deploy the app.