mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 20:42:40 +00:00
feat: add kubernetes deployment with kustomize (#258)
Signed-off-by: Guilhem Lettron <guilhem@barpilot.io>
This commit is contained in:
parent
e4bbd756f0
commit
a3a3d367ea
6 changed files with 164 additions and 0 deletions
75
deploy/README.md
Normal file
75
deploy/README.md
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
# kustomize
|
||||||
|
|
||||||
|
## Simple
|
||||||
|
|
||||||
|
`kustomization.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: opengist
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- https://github.com/thomiceli/opengist/deploy/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Full example
|
||||||
|
|
||||||
|
`kustomization.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: opengist
|
||||||
|
|
||||||
|
namespace: opengist
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- namespace.yaml
|
||||||
|
- https://github.com/thomiceli/opengist/deploy/?ref:v1.7.1
|
||||||
|
|
||||||
|
images:
|
||||||
|
- name: ghcr.io/thomiceli/opengist
|
||||||
|
newTag: 1.7.1
|
||||||
|
|
||||||
|
patches:
|
||||||
|
# Add your ingress
|
||||||
|
- path: ingress.yaml
|
||||||
|
- patch: |-
|
||||||
|
- op: add
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: opengist.mydomain.com
|
||||||
|
target:
|
||||||
|
group: networking.k8s.io
|
||||||
|
version: v1
|
||||||
|
kind: Ingress
|
||||||
|
name: opengist
|
||||||
|
```
|
||||||
|
|
||||||
|
`namespace.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: opengist
|
||||||
|
```
|
||||||
|
|
||||||
|
`ingress.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: opengist
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: letsencrypt-production
|
||||||
|
spec:
|
||||||
|
ingressClassName: nginx
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- opengist.mydomain.com
|
||||||
|
secretName: opengist-tls
|
||||||
|
```
|
29
deploy/deployment.yaml
Normal file
29
deploy/deployment.yaml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: opengist
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: opengist
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: opengist
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: opengist
|
||||||
|
image: ghcr.io/thomiceli/opengist
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 6157
|
||||||
|
- name: ssh
|
||||||
|
containerPort: 2222
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /opengist
|
||||||
|
name: data
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: opengist-data
|
20
deploy/ingress.yaml
Normal file
20
deploy/ingress.yaml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: opengist
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: opengist
|
||||||
|
app.kubernetes.io/component: ingress
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: opengist.local
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- pathType: Prefix
|
||||||
|
path: "/"
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: opengist
|
||||||
|
port:
|
||||||
|
name: http
|
11
deploy/kustomization.yaml
Normal file
11
deploy/kustomization.yaml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: opengist
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- deployment.yaml
|
||||||
|
- pvc.yaml
|
||||||
|
- ingress.yaml
|
||||||
|
- service.yaml
|
15
deploy/pvc.yaml
Normal file
15
deploy/pvc.yaml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: opengist-data
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: opengist
|
||||||
|
app.kubernetes.io/component: data
|
||||||
|
spec:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
|
volumeMode: Filesystem
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
14
deploy/service.yaml
Normal file
14
deploy/service.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: opengist
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: opengist
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: opengist
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: http
|
||||||
|
name: http
|
Loading…
Reference in a new issue