An example app written in go to show some of the features of kubernetes.
- Create a github account (if you don't already have one): https://github.com/join?source=header-home
- Install docker: https://hub.docker.com/?overlay=onboarding
- Create a docker hub account (if you don't already have one): https://hub.docker.com/signup?next=%2F%3Fref%3Dlogin
- Authenticate your local docker installation to your docker hub account by opening a terminal/prompt and executing
docker login
then entering your credentials
- Follow OS specific instructions for your machine:
- Install chocolatey: https://chocolatey.org/docs/installation#installing-chocolatey
- Install git: https://git-scm.com/download/win
- Install kubectl:
choco install kubernetes-cli
- Install minikube:
choco install minikube
- Start minikube:
minikube start
- Install helm:
choco install kubernetes-helm
- Install skaffold:
choco install skaffold
- Install homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install git:
brew install git
- Install kubectl:
brew install kubernetes-cli
- Install minikube:
brew cask install minikube
- Start minikube:
minikube start
- Install helm:
brew install kubernetes-helm
- Install skaffold:
brew install skaffold
Minikube provides you with a fully functional kubernetes cluster to test with. Skaffold provides the ability to quickly push changes that you write into an app or deployment into a cluster (like minikube).
- Start by forking this repository into your own github account by clicking the 'fork' button at the top right corner of this page.
- Now clone this repository to a directory on your workstation (replace
jwenz723
with your username):git clone https://github.com/jwenz723/kubernetes-workshop-demohttp.git
- cd into the cloned directory:
cd kubernetes-workshop-demohttp
- Start up the apps using skaffold:
skaffold dev --port-forward
(this will port-forward the pod ports to your workstation) - Once the pods have started up you will see all of the logs for both pods flowing in your terminal, including a log line for each app stating which port (frontend: 9000, backend: 9001) each pod was forwarded to on your workstation.
- Browse to http://localhost:9000/hello to test the frontend app. This page does a call to the backend service/pod then
prints the message that was received from the backend (
Hello, from the underworld!
) on the page with a frontend prefix (Underworld says:
). The complete message you should see is the following:
Underworld says: Hello, from the underworld!
- While the apps are running, modify the source code of either the backend or frontend app then save your changes. (If
you're not sure what code to change, you can start by modifying the value of
HELLO_RESPONSE
in cmd/frontend/main.go) - Skaffold will automatically recompile the app and then deploy the changes into your minikube instance.
- Follow the instructions here to get your minikube instance setup to mirror what is deployed into our 'production' kubernetes cluster: https://github.com/jwenz723/kubernetes-workshop-flux
- After you have finished those steps, make sure to come back to this repo and try out the steps below.
-
Now that you have played with development of these apps, it is time for you to commit back to the project.
-
Add yourself as a contributor by modifying the
contributors
slice/array found in cmd/backend/main.go within thehandleContributors()
function. -
Create a new git commit with your changes included:
git add . git commit -m "Added myself to contributors" git push
-
Now create a pull request to merge your fork into the original repository: https://github.com/jwenz723/kubernetes-workshop-demohttp/compare
-
Once your changes have been merged, you will see a build kick off in Jenkins, followed by the newly created docker image deployed to EKS.
-
You have successfully followed the flow of GitOps to deploy code changes into a kubernetes cluster.