The folder udacity-c3-feed-service-b contains the same code as udacity-c3-feed-service but is changed to add the text โB version โ to the start of each images comments to show it is a different version from udacity-c3-feed-service. This is only needed so can have two docker containers with different code to make it easier for testing A/B Deployment and validating the different code is being used.
- kubeone v0.9.0 or newer installed, which can be done by following the Installing KubeOne section of the README
- terraform v0.12.0 or later installed. Older releases are not compatible. The binaries for terraform can be found on the Terraform website
- Instructions for installing kubeone on AWS
- Go to udacity-cloud-c03/udacity-c3-deployment/tf folder
- See what commands will be made to create infrastructure:
terraform plan
- Provision the infrastructure:
terraform apply
- Say
yes
to confirm provisioning the infrastructure
- Say
- Create Terraform state file to be parsed by kubeone:
terraform output -json > tf.json
- Install Kubernetes using configuration output from Terraform:
kubeone install config.yaml --tfjson tf.json
- Setup KUEBCONFIG variable that will be used by kubectl commands, run this command in any terminal window that the kubectl command will be run in
export KUBECONFIG=$PWD/demo2-kubeconfig
You will need to install the kubectl command. Open a new terminal within the project directory and run:
- Generate encrypted values for aws credentials, Database User Name, and Database Password using bcrypt and put the values into aws-secret.yaml and env-secret.yaml files
- Load secret files:
kubectl apply -f aws-secret.yaml
kubectl apply -f env-secret.yaml
- Load config map:
kubectl apply -f env-configmap.yaml
- Apply Deployments:
kubectl apply -f backend-feed-deployment.yaml
kubectl apply -f frontend-deployment.yaml
kubectl apply -f backend-user-deployment.yaml
- Apply Services:
kubectl apply -f backend-feed-service.yaml
kubectl apply -f backend-user-service.yaml
kubectl apply -f frontend-service.yaml
- Deploy reverse proxy, has to be done after the services are running:
kubectl apply -f reverseproxy-deployment.yaml
kubectl apply -f reverseproxy-service.yaml
- Perform port forwarding (each needs to be run in a separate terminal window and left running)
kubectl port-forward service/frontend 8100:8100
kubectl port-forward service/reverseproxy 8080:8080
kubectl get nodes
kubectl get pod --all-namespaces
kubectl get svc
kubectl get configmaps
kubectl get secrets
kubectl describe secret/env-secret
- Travis CI is setup to monitor for updates to any branches and will automatically build and deploy the Docker containers.
- For this to work the DOCKER_PASSWORD and DOCKER_USERNAME environment variables had to be set in Travis CI. Instructions for setting this up