Created
February 14, 2023 09:39
-
-
Save mrhalix/f520f4153dfdc01c97dcc1da49dbc25a to your computer and use it in GitHub Desktop.
A kubernetes cronjob which concurrently runs two commands when it starts, jobs: docker daemon + python script which uses docker pull,tag,push
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1 | |
kind: CronJob | |
metadata: | |
name: JOBNAME | |
namespace: NAMESPACE | |
spec: | |
schedule: "0 3 */10 * *" | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
volumes: | |
- name: kubeconfig | |
secret: | |
secretName: kube-configs | |
containers: | |
- name: CONTAINERNAME | |
image: IMAGE | |
imagePullPolicy: IfNotPresent | |
securityContext: | |
privileged: true | |
command: | |
- sh | |
- -c | |
- | | |
/usr/local/bin/dockerd-entrypoint.sh & | |
python3 XXX.py & | |
wait | |
# make docker and python code run concurently | |
volumeMounts: | |
- name: kubeconfig | |
readOnly: true | |
mountPath: "/root/kubeconfig" | |
resources: | |
limits: | |
cpu: 500m | |
memory: 1G | |
requests: | |
cpu: 500m | |
memory: 1G | |
restartPolicy: OnFailure | |
imagePullSecrets: | |
- name: REGISTRYSECRET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment