Commit 9a1250ae authored by Tim Bleimehl's avatar Tim Bleimehl 🤸🏼
Browse files

wip

parent a393ebb2
Pipeline #1474 passed with stage
in 58 seconds
......@@ -160,45 +160,65 @@ spec:
### Setup Databases
We use the CoDaBuddy Docker Container `auto-create`-feature to create our user and database
Just for fun we now use the CoDaBuddy Docker Container `auto-create`-feature to create our user and database
`docker pull registry-gl.connect.dzd-ev.de:443/dzdtools/codabuddy`
`docker run --rm -it --network=host -v ~/.kube/config:/.kube/config registry-gl.connect.dzd-ev.de:443/dzdtools/codabuddy auto-create --debug kubernetes --all-namespaces`
todo-note: this is not working due to missing role auth
results in `Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:default:default" cannot list resource "pods" in API group "" at the cluster scope`
`kubectl run codabuddy --restart=Never --rm -i --image=registry-gl.connect.dzd-ev.de:443/dzdtools/codabuddy -- auto-create --debug kubernetes --all-namespaces `
> ToDo-note: this is not working due to missing role auth
> results in `Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:default:default" cannot list resource "pods" in API group "" at the cluster scope`
> `kubectl run codabuddy --restart=Never --rm -i --image=registry-gl.connect.dzd-ev.de:443/dzdtools/codabuddy -- auto-create --debug kubernetes --all-namespaces `
### Backup
Now we create a CronJob for CoDaBuddy to create a daily backup
Now we create a CronJob for CoDaBuddy to create a daily backup every night at 00:00
```yaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: hello
name: CoDaBuddy-backupjob
spec:
schedule: "* * * * *"
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox
imagePullPolicy: IfNotPresent
- name: CoDaBuddy-backupjob
image: registry-gl.connect.dzd-ev.de:443/dzdtools/codabuddy
imagePullPolicy: Always
volumeMounts:
- mountPath: /backup
name: backup-vol
- mountPath: /.kube/config
name: kubeconf-vol
command:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
- backup
- --all-namespaces
restartPolicy: OnFailure
volumes:
- name: backup-vol
hostPath:
# path to store backups in the cluster host. This is obviously just a test setup. dont do that in productive
path: /tmp/backup
# this field is optional
type: Directory
- name: kubeconf-vol
hostPath:
# path to store the kube config. This is obviously just a test setup. dont do that in productive
path: /home/myname/.kube/config
# this field is optional
type: Directory
```
### What else..?
DISCLAIMER/HINT: this is a simple alpha state POC. In future version there will be a more secure/regulated example to access to the kubernetes api via roles and kubectl proxy https://kubernetes.io/docs/tasks/run-application/access-api-from-pod/
You can also define a kubernetes CronJob deployment to run your
# Planned features
......
......@@ -5,8 +5,8 @@ USER 0
COPY --from=docker:latest /usr/local/bin/docker /usr/local/bin/
# RUN groupadd docker && useradd -u 1001 -g docker justaname
# install python3
#RUN install_packages python3.9 python3-pip git
RUN apt update && apt search python3
RUN install_packages python3 python3-pip git
#RUN install_packages software-properties-common && add-apt-repository ppa:deadsnakes/ppa && install_packages python3-9 python3-pip git
# install required python modules
......
......@@ -15,7 +15,7 @@ setup(
license="MIT",
packages=["CoDaBuddy"],
install_requires=["DZDConfigs", "Click", "tabulate", "humanize", "pyyaml"],
python_requires=">=3.9",
python_requires=">=3.7",
zip_safe=False,
include_package_data=True,
use_scm_version={
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment