Capstone project, Cloud DevOps Nanodegree FAQ
Useful starter codes and tutorials for the Capstone
This tutorial is going to be very helpful for the capstone project: How to create an AWS EKS cluster using CircleCI, AWS EKS Orb
This tutorial is going to be very helpful to get started with the capstone project: Great starting examples of CICD pipelines for kubernetes apps using CircleCI and AWS EKS
This tutorial is going to be very useful for the capstone project and it will teach you how to configure and execute a rolling update strategy in kubernetes
How to install docker, aws cli, eksctl, kubectl for Jenkins in Linux Ubuntu 18.04?
FAQ
- Do I have to setup the EKS cluster also with a CloudFormation script or can this be done manually?
The EKS cluster should be created using a CloudFormation script
The students may also use Ansible
2. How to deploy your microservices to kubernetes and access them with a Load Balancer External IP?
3. Kuberneter cluster error You must be logged in to the server Unauthorized
3. How to create a kubertenes cluster in AWS EKS?
4. How to deploy an image to your kubertenes cluster in AWS EKS?
1a. Launch a Guest Book Application https://docs.aws.amazon.com/eks/latest/userguide/eks-guestbook.html
1b. Use the commands in your run_kubernetes.sh file in your Operatilize an ML project
5. just out of curiosity could I run a kuberrnetes deployment within an ec2 . instance and would that be ok. (or rather would it work)
No, you need to use EKS
AWS EKS
6. How build and push an image using docker in Jenkins?
- The first step is to install docker in your computer or EC2 instance where you have Jenskins installed. You can use this tutorial for linux ubuntu https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
- Then, you need to create the credentials for docker in your Jenkins. You can see a good tutorial here https://medium.com/@gustavo.guss/jenkins-building-docker-image-and-sending-to-registry-64b84ea45ee9.
- Then, you can add a new stage and steps for building the docker image, where you are going to run a docker cli command using the shell. This is an example for building the image:
stage('Build Docker Image') {
steps {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'dockerhub', usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD']]){ sh '''
docker build -t andresaaap/cloudcapstone:$BUILD_ID .
''' }
}
}
- Then, you can add a new stage and steps for pusshing the docker image, where you are going to run a docker cli command using the shell. You can see the command in this tutorial https://docs.docker.com/docker-hub/repos/
7. How to create a kubernetes cluster in AWS EKS using Jenkins and eksctl?
- First, install eksctl, aws cli and kubectl following this guide https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html
- Then, make sure that you have your AWS credentials in Jenkins. If not, create your AWS credentials in Jenkins.
- Then, make sure that the AWS IAM user that you are using has all the correct permissions. That can be a problem if not done properly.
8. What could be a good example of the pipelines for this project?
Guide
9. I am getting the following error when running a docker command in Jenkins:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post
Please refer to this link https://stackoverflow.com/questions/47854463/got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket-at-uni
10. What is blue and green deployment?
Colorful deployments: An introduction to blue-green, canary, and rolling deployments
The process basicly works like this:
- Deploy version 1 of the software in blue and green
- Blue is the one that receives the traffic
- Deploy version 2 of the software in green
- Green is the one that receives the traffic
- Deploy version 2 of the software in blue
- Blue is the one that receives the traffic
11. How to implement blue and green deployment using a domain and the alias record?
- Buy a domain in AWS
- Create an alias record that redirects the traffic to the domain, to the URL of the blue or green cluster. For example, to redirect the traffic to the domain my-udacity-capstone.com to your cluster’s URL. You will need a JSON file with the necessary instructions and to use the following command:
aws route53 change-resource-record-sets — hosted-zone-id ZKCU19G790VD6 — change-batch file://alias-record.json
To learn more about this please look at this link:
12. How to implement blue and green deployment using a domain and the alias record?
- Create a load balancer
- To redirect traffic just to the blue cluster or system, register the blue cluster or system as a target in the load balancer
- To redirect traffic just to the green cluster or system, register the green cluster or system as a target in the load balancer. Then, remove the blue cluster or system as a target
To read more about load balancers please look at this:
13. I‘m having difficulty getting a good start on the Capstone. I just want to do something basic and I read through the answers and links on your Medium page, but keep hitting roadblocks trying to know where to even start. I followed the Jenkins X tutorial and it’s quite nice, but it seems to conflict with the rubric item requiring that the cluster be deployed with CloudFormation or Ansible since no CF or Ansible is needed for Jenkins X? If I can’t take full advantage of it because of the rubric, why is it presented as an option?
- If you use Jenkins X to create the cluster >> under the covers this will download and use the eksctl tool to create a new EKS cluster, then it’ll install Jenkins X on top >> eksctl uses CloudFormation
- You need to add this explanation in the README
14. How to install AWS CLI and its required dependencies for using it in Jenkins?
Follow the instructions in the following link: https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html
- You need to install PIP before.
- Then install AWS CLI
Please DO NOT use the following flag in the commands that you run or you are not going to install AWS CLI and PIP globally and you will have problem:
--user
15. What tutorials on how to implements blue and green deployment can I see?
Blue/Green Deployments with Amazon Elastic Container Service
16. What is a good tutorial to learn kubernetes and its commands?
Please take a look at this:
17. What is a ReplicationController in kubernetes?
This refer to this:
18. How are kubernetes objects like pods or services created or updated?
19. How are kubernetes objects like pods or services created or updated using ‘kubectl apply’?
20. How to create a step in the jenkins pipeline that stops the execution after deploying blue and wait until the user clicks to continue to green?
21. I mean how would I apply the updated docker image to the blue or green cluster(like for example if I changed the html) and make it show up?
This command will update your container
kubectl apply -f ./blue-controller.json
22. How to get the information and IP of a service?
kubectl describe service NAME_OF_SERVICE
For more information https://kubernetes.io/docs/reference/kubectl/cheatsheet/
23. How to list all pods in the namespace, with more details?
kubectl get pods -o wide
For more information https://kubernetes.io/docs/reference/kubectl/cheatsheet/
24. How to access the website that you deployed in kubernetes with the Jenkins pipeline using a service?
Get the information the service
Then, in your browser
LOAD_BALANCER_INGRESS + : + PORT
25. How to debug the application that you deployed in the cluster and to see if you deployed it correctly?
Please follow these guides:
- Testing a container app or microservices app to deploy it to an AWS EKS cluster
- Errors in kubernetes and debugging
Cool links to explore
Examples of Jenkins pipelines that build, push and deploy containers
Continuously delivering apps to Kubernetes using Helm — Adnan Abdulhussein (Bitnami)
Jenkins Building Docker Image and Sending to Registry
https://medium.com/@gustavo.guss/jenkins-building-docker-image-and-sending-to-registry-64b84ea45ee9
What is jenkins X?
Kubernetes CI CD with AWS EKS and Jenkins X — Henryk Konsek
Jenkins X: Continous Delivery for Kubernetes. Carlos Sanchez, Cloud Bees
Cloud Native CI CD with Jenkins X and Knative Pipelines Christie Wilson + James Rawling