deployment incluing memcached

This commit is contained in:
Remy Moll 2024-08-01 18:00:49 +02:00
parent 6aaa8fc1b3
commit c9df181256
6 changed files with 66 additions and 1 deletions

View File

@ -15,11 +15,23 @@ Before deploying the backend application, ensure that you have the following pre
## Deployment Steps
### Initial deployment
To deploy the backend application, follow these steps:
1. Clone this repository: `git clone https://github.com/your-repo.git`
1. Apply the kustomization: `kubectl apply -k .`
### Rolling updates
Since the deployment uses the `latest` tag for the backend application, we simply need to trigger a rolling update which will pull the latest image from the registry. To do this, run the following command:
```bash
kubectl -n anyway-backend rollout restart deployment/nav-backend
```
## Configuration
The kustomization allows for easy configuration of the backend application. To customize the deployment, modify the `kustomization.yaml` file.
### Memcached
The backend application requires a memcached instance. By default, the kustomization deploys this instance, as configured under `memcached/`. To disable this, comment out the `memcached` overlay in the `kustomization.yaml` file.

View File

@ -14,7 +14,10 @@ spec:
spec:
containers:
- name: worker
securityContext:
allowPrivilegeEscalation: false
image: backend-image
imagePullPolicy: Always
ports:
- containerPort: 8000
env:
@ -22,6 +25,8 @@ spec:
value: "3"
- name: OSM_CACHE_DIR
value: "/osm-cache"
- name: MEMCACHED_HOST_PATH
value: "memcached:11211"
volumeMounts:
- name: osm-cache
mountPath: /osm-cache

View File

@ -9,6 +9,8 @@ resources:
- deployment.yaml
- service.yaml
- ingress.yaml
- memcached/
images:
- name: backend-image

22
memcached/deployment.yaml Normal file
View File

@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: memcached
spec:
replicas: 1
selector:
matchLabels:
app: memcached
template:
metadata:
labels:
app: memcached
spec:
containers:
- name: memcached
securityContext:
allowPrivilegeEscalation: false
image: memcached
imagePullPolicy: IfNotPresent
ports:
- containerPort: 11211

View File

@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
images:
- name: memcached
newName: memcached
newTag: 1.6.29

11
memcached/service.yaml Normal file
View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: memcached
spec:
selector:
app: memcached
ports:
- protocol: TCP
port: 11211
targetPort: 11211