add minikube use case

This commit is contained in:
Boris Manojlovic
2023-05-24 12:59:05 +02:00
parent 3e898a9b61
commit ec8e6f6c10
5 changed files with 97 additions and 1 deletions
+5 -1
View File
@@ -6,6 +6,10 @@ prepare:
@mkdir -p output
sed -e "s@__DOMAIN_NAME__@$(DOMAIN_NAME)@g;s@__DOMAIN_NAME_DASHED__@$(DOMAIN_NAME_DASHED)@g" *.yaml > output/mirotalk-k8s.yaml
prepare-minikube:
@mkdir -p output
sed -e "s@__DOMAIN_NAME__@$(DOMAIN_NAME)@g;s@__DOMAIN_NAME_DASHED__@$(DOMAIN_NAME_DASHED)@g" minikube/*.yaml > output/mirotalk-k8s.yaml
deploy:
kubectl delete configmap p2p || echo "ignore error"
kubectl create configmap p2p --from-file=.env=env.txt
@@ -15,7 +19,7 @@ env.txt:
@test -f env.txt || cp -v ../.env.template env.txt
uninstall:
kubectl delete configmap p2p
kubectl delete configmap p2p || :
kubectl delete -f output/mirotalk-k8s.yaml
rm -rf env.txt output
+23
View File
@@ -5,6 +5,8 @@
make
sed -i s/localhost/myshinydomain.tld/g env.txt
make prepare
# or make prepare-minikube
# for testing purposes
make deploy
```
@@ -13,6 +15,7 @@ If you would like to deploy Mirotalk to kubernetes
this set of files can help you in that task
Bellow is explanation of files in this folder which will form one output file in `output` folder
## ../.env.template and your file env.txt that you should prepare
Configuration file that is for now used to configure deployment
you should copy `../.env.template` to current directory as `env.txt` and edit values inside to your liking
@@ -29,10 +32,13 @@ Main deployment file where you change image file if you would like to use yours
## p2p-cert.yaml
This file represent definition of certificate (request) when using [Cert Manager](cert-manager.io) to generate letsencrypt or private certificates for your domain will be pulled out from `env.txt`
## p2p-ingress.yaml
This is generic ingress object in kubernetes that is responsible to route external traffic to mirotalk deployed application and if used in conjuction with p2p-cert.yaml (default) will provide TLS enabled access to your mirotalk instance
## p2p-service.yaml
Service required for ingress to be able to know how to access deployment
## Makefile
Helper file that allows running it to configure application how you would like
@@ -47,3 +53,20 @@ make
make prepare
make deploy
```
# MiniKube considerations
```
minikube start
minikube addons enable ingress
minikube ip
make
sed -i "s/localhost/p2p.$(minikube ip|sed -e 's/[.]/-/g').nip.io/g" env.txt
make prepare-minikube
make deploy
echo "You should be able to open $(echo https://p2p.$(minikube ip|sed -e 's/[.]/-/g').nip.io)` in your browser"
```
You should be able to open `p2p.$(minikube ip|sed -e 's/[.]/-/g').nip.io` - if as for me this does not work 100% of times in that case:
So it is "working for you", as for me it is "meh almost works"
+35
View File
@@ -0,0 +1,35 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: p2p
name: p2p
spec:
replicas: 1
selector:
matchLabels:
app: p2p
strategy: {}
template:
metadata:
labels:
app: p2p
spec:
containers:
- image: mirotalk/p2p:latest
name: mirotalk
ports:
- containerPort: 3000
volumeMounts:
- name: p2p-env
mountPath: /src/.env
subPath: .env
resources: {}
volumes:
- name: p2p-env
configMap:
name: p2p
defaultMode: 0644
restartPolicy: Always
status: {}
+18
View File
@@ -0,0 +1,18 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: p2p-ingress
spec:
rules:
- host: __DOMAIN_NAME__
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: p2p
port:
number: 3000
ingressClassName: nginx
+16
View File
@@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
labels:
app: p2p
name: p2p
spec:
ports:
- port: 3000
protocol: TCP
targetPort: 3000
selector:
app: p2p
type: NodePort
status: