I'm on my way to learn k8s, and I'd love to know how we can create boilerplate for cronjob.
I know it used to be follwoing.
kubectl run mycron --schedule "1 * * * *" --image nginx -o yaml --dry-run
.
Even it still outputs the boilerplate but it says following.
kubectl run --generator=cronjob/v1beta1 is DEPRECATED and will be removed in a future version. Use kubectl create instead.
However I couldn't find how to generate it with kubectl create
. Any ideas?
It looks it's no more possible to create the scaffolding directly from the CLI:
# kubectl create
(...)
Available Commands:
clusterrole Create a ClusterRole.
clusterrolebinding Create a ClusterRoleBinding for a particular ClusterRole
configmap Create a configmap from a local file, directory or literal value
deployment Create a deployment with the specified name.
job Create a job with the specified name.
namespace Create a namespace with the specified name
poddisruptionbudget Create a pod disruption budget with the specified name.
priorityclass Create a priorityclass with the specified name.
quota Create a quota with the specified name.
role Create a role with single rule.
rolebinding Create a RoleBinding for a particular Role or ClusterRole
secret Create a secret using specified subcommand
service Create a service using specified subcommand.
serviceaccount Create a service account with the specified name
As you can see, no cronjobs
command available: from my experience, I would suggest you to checkout API documentation according to your Kubernetes running version and fill a temporary YAML and then proceed with a kubectl create -f path/to/file.yaml