-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
K8s cronjob example potentially problematic #159
Comments
Thanks. As I have 0 experience with k8, I depend on others providing these. So thank you! quick question: any particular reason you are requesting also, I’d go so far as to say you absolutely need to have a persistent state directory. Otherwise you are not benefiting from caching or rate limiting and will therefore waste a lot of resources. |
Yep, pretty much - using With a specific version tag, I know exactly what will have run, so
If you're really unlucky, you can end up with pods running different versions too - the default imagePullPolicy is It's almost certainly overkill for this, but it's a habit that's pretty heavily ingrained from managing infra.
Yep, that was my thinking too - I left it as an option partly because it's optional for Github actions, but also because it means that a copy and paste of the YAML should just work. Once you start adding PVCs that tends to stop being the case (because people use different backends for their PVs) |
@bentasker Does it still need this stuff at the top? ---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: fedifetcher-pvc
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 100Mi
--- |
It depends on whether the operator wants to use a PVC to keep persistent state. For example, I quite often use NFS instead which doesn't require one. I tend to leave them out of examples on the basis that anyone using them will probably know to set it up. |
The example k8s cronjob embeds secrets (the token) into the YAML.
That's generally considered poor security hygiene as there's a non-zero risk of someone then committing/uploading that to something public etc.
Instead, a k8s secret should be created in order to then expose the token as an environment variable (this also avoids anything which might log the commandline from including the sensitive value).
For example, my quick setup looks like this:
Create the secret
kubectl create secret generic fedifetcher \ --from-literal=server_domain=mastodon.bentasker.co.uk \ --from-literal=token="<token>"
Define the cronjob
The text was updated successfully, but these errors were encountered: