Cloud DevOps ND - C4- Microservices at Scale using AWS & Kubernetes - Supporting Material and Project Starter

This repository is associated with Cloud DevOps ND - Course 04 - Microservices at Scale using AWS & Kubernetes. In here, you'll find:

  1. Supporting material used in the video demonstration in the course
  2. Starting code for a project, in which you can containerize and deploy a machine learning srevice using Kubernetes.

A. Dependencies

A.1. Python

Download and install the python.

A.2. Docker Desktop

You would require you to install Docker Desktop to create containers for individual microservices. Refer the following links for instructions

A.3. Kubernetes

You would need to install any one tool for creating a Kubernetes cluster - KubeOne / Minikube / kubectl on top of Docker Desktop:

  1. Install and Set Up kubectl directly on top of Docker desktop - For Windows/macOS
  2. Install Minikube - For Linux/macOS

A.4. AWS account to access AWS Lambda

You'll need an AWS account to get started with AWS Lambda, which is a serverless computing platform on cloud.

A.5. An account with Circle CI

You may sign up on CircleCI.com with your GitHub credentials.


B. The Overarching Diagram

Overview


C. Tutorials

C.1. AWS Lambda & Serverless

  • Making Change: Create and deploy a serverless lambda function that responds to an input request; this example creates the correct amount of change to make up a value in US dollars.
  • Wikipedia Query: Deploy a lambda function that responds to an input, wikipedia page query; this example returns the first sentence of a specific wikipedia page upon being queried.

D. Project Instructions

To run any project code, you'll have to set up a virtual environment with the project dependencies. All of the following instructions are to be completed via a terminal/command line prompt.

E. Create and Activate an Environment

E.1. Git and version control

These instructions also assume you have git installed for working with Github from a terminal window, but if you do not, you can download that first from this Github installation page.

Now, you're ready to create your local environment!

  1. If you haven't already done so, clone the project repository, and navigate to the main project folder.
git clone https://github.com/udacity/DevOps_Microservices.git
cd DevOps_Microservices/project-ml-microservice-kubernetes
  1. Create (and activate) a new environment, named .devops with Python 3. If prompted to proceed with the install (Proceed [y]/n) type y.
python3 -m venv ~/.devops
source ~/.devops/bin/activate

At this point your command line should look something like: (.devops) <User>:project-ml-microservice-kubernetes<user>$. The (.devops) indicates that your environment has been activated, and you can proceed with further package installations.

  1. Installing dependencies via project Makefile. Many of the project dependencies are listed in the file requirements.txt; these can be installed using pip commands in the provided Makefile. While in your project directory, type the following command to install these dependencies.
make install

Now most of the .devops libraries are available to you. There are a couple of other libraries that we'll be using, which can be downloaded as specified, below.


E.2. Other Libraries

While you still have your .devops environment activated, you will still need to install:

  • Docker
  • Hadolint
  • Kubernetes (Minikube if you want to run Kubernetes locally)

E.3. Docker

You will need to use Docker to build and upload a containerized application. If you already have this installed and created a docker account, you may skip this step.

  1. You’ll need to create a free docker account, where you’ll choose a unique username and link your email to a docker account. Your username is your unique docker ID.

  2. To install the latest version of docker, choose the Community Edition (CE) for your operating system, on docker’s installation site. It is also recommended that you install the latest, stable release:

  3. After installation, you can verify that you’ve successfully installed docker by printing its version in your terminal: docker --version

E.4. Run Lint Checks

This project also must pass two lint checks; hadolint checks the Dockerfile for errors and pylint checks the app.py source code for errors.

  1. Install hadolint following the instructions, on hadolint's page:

For Mac:

brew install hadolint

For Windows:

scoop install hadolint
  1. In your terminal, type: make lint to run lint checks on the project code. If you haven’t changed any code, all requirements should be satisfied, and you should see a printed statement that rates your code (and prints out any additional comments):
------------------------------------
Your code has been rated at 10.00/10

That's about it! When working with kubernetes, you may need to install some other libraries, but these instructions will set you up with an environment that can build and deploy Docker containers.