Hello World
셸에서 docker 명령어로 바로 실행하는 컨테이너를, 쿠버네티스 클러스터 위에서는 워크플로우로 실행할 수 있어요. Argo Workflows의 첫 예제인 hello-world 워크플로우를 살펴봐요.
본문
docker 명령어로 이 컨테이너를 셸에서 바로 실행해 볼 수 있어요:
$ docker run busybox echo "hello world"
hello world
아래에서는 같은 컨테이너를 쿠버네티스 클러스터에서 워크플로우로 실행해요. 주석에 유용한 설명이 담겨 있어요.
apiVersion: argoproj.io/v1alpha1
kind: Workflow # new type of k8s spec
metadata:
generateName: hello-world- # name of the workflow spec
spec:
entrypoint: hello-world # invoke the hello-world template
templates:
- name: hello-world # name of the template
container:
image: busybox
command: [ echo ]
args: [ "hello world" ]
resources: # limit the resources
limits:
memory: 32Mi
cpu: 100m
Argo는 Workflow라는 새로운 kind의 쿠버네티스 리소스를 추가해요.
위 스펙에는 hello-world라는 단일 template이 들어 있고, 이 템플릿은 busybox 이미지를 실행해 echo "hello world"를 호출해요.
hello-world 템플릿이 이 스펙의 entrypoint예요.
entrypoint는 워크플로우 스펙이 실행될 때 처음 호출할 템플릿을 지정해요.
워크플로우 스펙에 여러 템플릿이 정의되어 있을 때 entrypoint를 지정해 두면 유용해요.
더 알아보기 (Learn more)
- Argo CLI 튜토리얼에서 이 예제를 직접 제출해 보세요.
- 워크플로우 개념 문서에서 템플릿 구조를 익혀 보세요.