docs: added section on deploying to Minikube

This commit is contained in:
Dan Anglin 2023-02-19 20:17:29 +00:00
parent a483eae0cb
commit 5c50033787
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638

View file

@ -37,7 +37,7 @@ https://www.alphavantage.co/support/#api-key
| Environment Variable | Description | Example |
|----------------------|------------------------------------------------|---------|
| SYMBOL | The symbol of the stock. | MSFT |
| SYMBOL | The stock's symbol. | MSFT |
| NWEEKS | Display the closing price for the last N weeks.| 7 |
| APIKEY | Your API key from Alpha Vantage. | |
@ -49,7 +49,7 @@ https://www.alphavantage.co/support/#api-key
## Running the docker image locally
The docker image is published to the GitLab container registry [here](https://gitlab.com/dananglin/stock-ticker/container_registry/3916158).
The docker image is published to the GitLab Container Registry [here](https://gitlab.com/dananglin/stock-ticker/container_registry/3916158).
You can pull and run the docker image from the registry with the following command:
```bash
@ -80,3 +80,24 @@ docker run --rm \
```
Now you can go to http://localhost:8080/stockprice in your browser to view a table of the latest weekly closing stock prices for `MSFT`.
## Deploying the web service on Minikube
The web service can be deployed on any distribution of Kubernetes but the below guide will focus on deployment onto a Minikube cluster.
The Kubernetes manifest can viewed [here](https://gitlab.com/dananglin/stock-ticker/-/blob/main/kubernetes/manifest.yaml) and you can download and modify it as you wish.
1. Follow [these instructions](https://k8s-docs.netlify.app/en/docs/tasks/tools/install-minikube/) to install and start a Minikube cluster.
2. Set up ingress using either the [Ingress DNS](https://minikube.sigs.k8s.io/docs/handbook/addons/ingress-dns/) or [Kong Ingress](https://minikube.sigs.k8s.io/docs/handbook/addons/kong-ingress/) addon.
3. Apply the Kubernetes manifest to your Minikube cluster.
```bash
kubectl apply -f https://gitlab.com/dananglin/stock-ticker/-/raw/main/kubernetes/manifest.yaml
```
4. Wait until the pods are running and in a 'Ready' state.
```bash
$ kubectl -n stock-ticker get pods
NAME READY STATUS RESTARTS AGE
stock-ticker-656859cf74-bb8w6 1/1 Running 0 29s
stock-ticker-656859cf74-nvnbf 1/1 Running 0 29s
stock-ticker-656859cf74-p6xzk 1/1 Running 0 29s
```
5. Go to http://stock-ticker.<YOUR_TLD>/stockprice from your browser.