Created
March 9, 2020 03:07
-
-
Save Odilhao/0df6a910dd3dbb1c4f67cab97945bfa9 to your computer and use it in GitHub Desktop.
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/v1beta1 | |
kind: CronJob | |
metadata: | |
name: script | |
spec: | |
schedule: "*/2 * * * *" | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
containers: | |
- name: tempo | |
image: fedora | |
args: | |
- /bin/bash | |
- -c | |
- /script/script.sh | |
volumeMounts: | |
- name: script | |
mountPath: /script/script.sh | |
subPath: script.sh | |
restartPolicy: OnFailure | |
volumes: | |
- name: script | |
configMap: | |
name: script-cm | |
defaultMode: 0777 |
cat <<'EOF' >> script.sh
#!/bin/bash
weather=$(curl -s wttr.in/Brasilia?format="%l:+%c+%t")
echo $weather
exit
EOF
$ kubectl create cm script-cm --from-file=script.sh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is excellent!
Can I get a look at how you setup your configMap "script"?