我有文件
example-workflow-cowsay.yml
:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-
spec:
entrypoint: whalesay
templates:
- name: whalesay
container:
image: docker/whalesay
command: [cowsay]
args: ["hello world"]
resources:
limits:
memory: 32Mi
cpu: 100m
我可以像这样成功提交:
argo submit -n workflows apps/workflows/example-workflow-cowsay.yml
。
我可以直接使用
kubectl
完成同样的事情吗?我尝试了以下方法,但失败了:
$ k apply -n workflows -f apps/workflows/example-workflow-cowsay.yml
error: from hello-world-: cannot use generate name with apply
是的,它就在docs中。
kubectl -n workflows create -f apps/workflows/example-workflow-cowsay.yml
完成了工作。
详细说明一下:这是有道理的,因为我试图“应用”的是工作流程的单次运行(认为是对象实例而不是类)。如果我尝试应用 CronWorkflow,那么
kubectl apply
就会起作用。我收到的错误消息:
error: from hello-world-: cannot use generate name with apply
跟我说过,但当时我不太明白。这是无效的:
apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
generateName: some-name
...
但这是有效的:
apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
name: some-name
...