Commit ddaeb745 authored by Bruce Flynn's avatar Bruce Flynn
Browse files

Update README

parent 94928751
# SSEC Brownbag: Kubernetes Q&A Minikube Example Code # SSEC Brownbag: Kubernetes Q&A Example Code
Presented on 04 Nov, 2019 (Slides [here](https://docs.google.com/presentation/d/1BjTPaM0n7XVFxXHyM1kRPpYxZmgAqinhd0LgUn_e8u4/edit?usp=sharing)) Presented on 04 Nov, 2019 (Slides [here](https://docs.google.com/presentation/d/1BjTPaM0n7XVFxXHyM1kRPpYxZmgAqinhd0LgUn_e8u4/edit?usp=sharing))
> NOTE: This is not intended as an example of best-practices for anything involved > NOTE: This is not intended as an example of best-practices for anything involved
...@@ -19,7 +19,7 @@ that will simply print out a message. There is also a Kubernetes ...@@ -19,7 +19,7 @@ that will simply print out a message. There is also a Kubernetes
that will collect results and status from the Job and enter the data in a that will collect results and status from the Job and enter the data in a
PostgreSQL database, the results of which will be availble to view in the App. PostgreSQL database, the results of which will be availble to view in the App.
It makes use of the following Kubernetes componets It makes use of the following Kubernetes resources
* [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) * [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/)
* [Service](https://kubernetes.io/docs/concepts/services-networking/service/) * [Service](https://kubernetes.io/docs/concepts/services-networking/service/)
...@@ -40,14 +40,39 @@ It makes use of the following Kubernetes componets ...@@ -40,14 +40,39 @@ It makes use of the following Kubernetes componets
* Install `minikube` * Install `minikube`
- https://kubernetes.io/docs/tasks/tools/install-minikube/ - https://kubernetes.io/docs/tasks/tools/install-minikube/
## Start K8S with the required plugins
## MacOS Setup using Docker Desktop
If you have a Mac (or potententially Windows?) rather than use minikube you can use the [Docker Desktop](https://www.docker.com/products/docker-desktop) app to provide a Kubernetes cluster.
Instructions courtesy of RayG
> helm can be had through macports (homebrew probably as well)
> ```
> sudo port install helm-2.14
> sudo port select --set helm helm2.14
> helm init --history=max 200
> ```
>
> ingress is also pretty quick to set up (note, can open ports to outside world!)
> ```
> kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
> kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud-generic.yaml
> ```
> those are from the instructions at https://kubernetes.github.io/ingress-nginx/deploy/
### Build our docker image
```
docker build -t say-hello .
```
## Minikube setup
### Start Minikube with the required plugins
``` ```
minikube start minikube start
minikube addons enable helm-tiller minikube addons enable helm-tiller
minikube addons enable ingress minikube addons enable ingress
``` ```
## Build our docker image ### Build our docker image
``` ```
eval $(minikube docker-env) eval $(minikube docker-env)
docker build -t say-hello . docker build -t say-hello .
...@@ -94,10 +119,8 @@ helm status myapp ...@@ -94,10 +119,8 @@ helm status myapp
``` ```
The app will be available via its [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) and [Service](https://kubernetes.io/docs/concepts/services-networking/service/) which will proxy conections into The app will be available via its [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) and [Service](https://kubernetes.io/docs/concepts/services-networking/service/) which will proxy conections into
the cluster to one of the 3 replicas available at the minikube IP address: the cluster to one of the 3 replicas available at the cluster address IP address. Using minikube it will be `http://$(minikube ip)/say-hello`, or using Docker Desktop it will simply be `http://localhost/say-hello`
```
echo http://$(minikube ip)/say-hello
```
If you navigate to the above URL you should see a simple form where you can enter in If you navigate to the above URL you should see a simple form where you can enter in
some text. There should also be a table listing all the jobs currently in the database. some text. There should also be a table listing all the jobs currently in the database.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment