first commit

This commit is contained in:
2025-11-25 19:11:49 +11:00
commit 8073a2274b
9 changed files with 207 additions and 0 deletions

43
README.md Normal file
View File

@@ -0,0 +1,43 @@
# Kubernetes deployment of calibre-web
This is a **Kubernetes** deployment of [calibre-web](https://github.com/janeczku/calibre-web) application which uses [linuxserver/calibre-web](https://hub.docker.com/r/linuxserver/calibre-web) docker image.
## How to
**Note** This deployment assumes the Kubernetes cluster runs the [NGINX Ingress Controller](https://kubernetes.github.io/ingress-nginx) as ingress controller. If you use another ingress controller, you will have to adapt `ingress.yml` accordingly.
git clone https://github.com/devtud/calibre-kubernetes
Edit `ingress.yml` and replace your domain name on this line:
```yml
- host: <your-domain>
```
Open `deployment.yml` and adapt the two values on the following lines according to your needs (the user id and group id which own the files on the host machine - **do not set it as root!**).
```yml
- name: PUID
value: "1001"
- name: PGID
value: "1001"
```
Apply the Kubernetes resources:
kubectl apply -f ns.yml
kubectl apply -f pv_books.yml
kubectl apply -f pv_config.yml
kubectl apply -f pvc_books.yml
kubectl apply -f pvc_config.yml
kubectl apply -f deployment.yml
kubectl apply -f service.yml
kubectl apply -f ingress.yml
**Important** Even though you can access the deployed `calibre-web` app at your address, you won't be able to use it, because neither the calibre-web app nor the docker image provide a Calibre database. You have to get a Calibre database first and upload it to `/var/data/calibre/books/metadata.db` (note that this is the path on your host machine where the persistent volume [pv_books.yml](pv_books.yml) is pointing to). One way of doing this is to install a fresh Calibre on your computer and copy the `metadata.db` file from your computer to the mentioned path.
After you open the web interface, in the config screen put the following values:
- `/books` for the db path
- `/usr/bin/ebook-convert` for the converter path
- `/usr/bin/unrar` for the unrar path

62
deployment.yml Normal file
View File

@@ -0,0 +1,62 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: calibre
namespace: calibre
labels:
app: calibre
version: latest
type: third-party
facing: internal
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: calibre
template:
metadata:
labels:
app: calibre
spec:
serviceAccountName: calibre-sa
securityContext:
runAsUser: 0
runAsGroup: 0
fsGroup: 0
containers:
- name: calibre
image: linuxserver/calibre-web:latest
env:
- name: PUID
value: "1001"
- name: PGID
value: "1001"
- name: TZ
value: "Europe/Bucharest"
- name: DOCKER_MODS
value: "linuxserver/calibre-web:calibre"
ports:
- name: "http-port"
containerPort: 8083
protocol: TCP
volumeMounts:
- name: calibre-config
mountPath: /config
- name: calibre-books
mountPath: /books
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "1000m"
volumes:
- name: calibre-config
persistentVolumeClaim:
claimName: calibre-config
- name: calibre-books
persistentVolumeClaim:
claimName: calibre-books

8
ns.yml Normal file
View File

@@ -0,0 +1,8 @@
apiVersion: v1
kind: Namespace
metadata:
name: calibre
labels:
app: calibre
type: third-party
facing: internal

15
pv_books.yml Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: calibre-books
namespace: calibre
spec:
capacity:
storage: 8Gi
nfs:
server: 192.168.0.105
path: /nfs/NFS/ocp/calibre/books
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: nfs

15
pv_config.yml Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: calibre-config
namespace: calibre
spec:
capacity:
storage: 500Mi
nfs:
server: 192.168.0.105
path: /nfs/NFS/ocp/calibre/config
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: nfs

13
pvc_books.yml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: calibre-books
namespace: calibre
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
storageClassName: nfs
volumeName: calibre-books

13
pvc_config.yml Normal file
View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: calibre-config
namespace: calibre
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
storageClassName: nfs
volumeName: calibre-config

22
route.yaml Normal file
View File

@@ -0,0 +1,22 @@
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: calibre-route
namespace: calibre
annotations:
cert-manager.io/issuer-kind: ClusterIssuer
cert-manager.io/issuer-name: letsencrypt-dns01-cloudflare
spec:
host: calibre.apilab.us
path: /
to:
kind: Service
name: calibre
weight: 100
port:
targetPort: http-port
tls:
termination: edge
certificate:
key:
wildcardPolicy: None

16
service.yaml Normal file
View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: calibre
namespace: calibre
labels:
app: calibre
spec:
selector:
app: calibre
ports:
- name: "http-port"
protocol: TCP
targetPort: 8083
port: 80