# Container Tutorial ## Getting Setup ### Install Homebrew Homebrew is an amazing package manager for installing packages on your OS. Requirements: - XCode: install it using this [link](http://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12) #### Installation 1. Open the terminal app (shortcut ==> cmd + space and type in terminal) 2. copy this command `ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` 3. Check your installation by typing `brew` in the terminal. If all is well, you should see something like this ![](https://i.imgur.com/3IANuMO.png =300x) ### Install Kubectl Kubectl is a tool that allows you access the kubernetes api. It is actually a proxy that sends api requests in the background. #### Installation 1. run this command `brew install kubectl` 2. Check your installation by typing `kubectl version --client`. If all is well, you should see something like this ```bash= Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"darwin/amd64"} ``` ### Install Docker Desktop #### Installation Follow this [link](https://docs.docker.com/docker-for-mac/install/). After installation, you should be able to run `docker --version`. If all is well, you'll see something like this ``` Docker version 20.10.7, build f0df350 ``` ### Kubernetes One of the great things about using the docker installation above is that it installs a kubernetes cluster on your local computer. You can crosscheck this by 1. opening the docker desktop application 2. click on the settings icon and you should see this ![](https://i.imgur.com/J8ogbGN.png) 3. If Enable kubernetes is not clicked, click on it and then click `apply and restart` at the bottom right corner. 4. Check your cluster information by running `kubectl get all`. If all is well, you should see something like this ``` NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 7h3m ``` 5. For extras such as completion etc, please look through this [link](https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/) ## Container Project We'll use this project that I designed for a recent course at the university. It listens to an IOT-device and shows the user different information about the information being passed. You can find a demo version online at https://iot.ebrinktech.com. This project is built using springboot and react. We're not really insterested in the technology of the application but we're more interested the devops aspect and our ability to manage CI/CD, deploy and scale with the help of kubernetes. ### Downloading the project 1. Clone the project by running `git clone https://cinch-remit@bitbucket.org/cinch-remit/iot-backend.git` in your terminal or any other way you clone git projects. 2. cd into the directory where you cloned the project `cd iot-backend` 3. You'll find a folder called container and I've prepared all the manifest files that you need to run this application through kubernetes on your device. Any questions? Leave a comment on this document.