https://github.com/lyteabovenyte/fortune
fortune quotes are inspiring. so let's save them in html files for later ✓
https://github.com/lyteabovenyte/fortune
kubernetes shell-scripts
Last synced: 2 months ago
JSON representation
fortune quotes are inspiring. so let's save them in html files for later ✓
- Host: GitHub
- URL: https://github.com/lyteabovenyte/fortune
- Owner: lyteabovenyte
- Created: 2024-06-29T00:14:58.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-04T02:12:27.000Z (almost 2 years ago)
- Last Synced: 2025-03-06T14:52:58.317Z (over 1 year ago)
- Topics: kubernetes, shell-scripts
- Language: Shell
- Homepage: https://mastodon.social/@lyteabovenyte
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
##### a simple docker image to save fortune quotes every 10 second to a html file
###### what's in there:
##### v1: emptyDir volume.
###### an emptyDir volume is used to share content between containers.
- [x] a dockerfile for the fortune image to use in your k8s pod
- [x] a bash shell script to write the quote from fortune command in /var/htdocs dir
- [x] the yaml manifest of the pod for k8s, plus a volume called html for both the web-server nginx serves from and html-generator to write the quotes to
###### Note:
- you may need to port-forward a port from your local machine to the pod using:
```
kubectl port-forward :80
```
- or you can also expose the pod through a service instead of port-forwarding (either LoadBalancer or NodePort)
- [x] the yaml manifest of the type LoadBalancer service for the pods to connect.
###### Note:
- if you are using [Minikube](https://minikube.sigs.k8s.io/docs/) you can examine the externalIP of your services using the command below:
```
minikube service
```
then you should be forwarded to you browser at the externalIP page.
##### v2: gitRepo volume:
###### visit branch gitRepo of the repo
- [x] in this branch of versioning, we have a nginx web-server that mounts the default path(/usr/share/nginx/html) to a gitRepo contianing the html pages
##### v3: hostPath volume:
###### using mongoDB database to persist JSON document in node filesystem using hostPath volume
###### visit branch HostPath of the repo
- create the pod from mongodb-pod-hostpath.yaml
- execute mongodb shell using ```kubectl exec -it mongodb mongosh``` and save some json docs
- after deleting the pod and recreating it you can see that the data is persisted in the node's filesystem
- you can examine that by SSHing inside the node and inspect /tmp/mongodb directory.
##### v4: PV and PVC using hostpath.
###### v5: StorageClass in branch StorageClass
- provisioning PV dynamically using storage classes.