A Pipeline is set of Tasks. Tasks run in parallel. The execution flow can be controlled implicitly (via one task consume a result of another) or explcitly with mechanisms like runAfter, when and finally.
A Task is a sequence of Steps. Steps run sequentially. The step can programmatically determine to execute or skip.
To execute a Pipeline create a PipelineRun, an object that identifies:
- the Pipeline to execute and
- the values of any parameters
Tekton creates a TaskRun for each Task in the Pipeline. A TaskRun is an object that identifies:
- the Task and
- the values of any parameters (passed from the PipelineRun)
The TaskRun is implemented by a Pod Each Step is implemented by a Container in the Pod.
- HF token
- s3 bucket and necessary keys for uploading results
- Access to cluster with tekton (installing Tekton)
-
Create a namespace where the Tekton pipeline will execute.
export $NAMESPACE=your_namespace
kubectl create ns $NAMESPACEor
oc new-project $NAMESPACEFor convenience, set the current context:
kubectl config set-context --current --namespace $NAMESPACE -
Create a secret
hf-secretcontaining your HuggingFace token in the namespace.kubectl create secret generic hf-secret \ --namespace ${NAMESPACE} \ --from-literal="HF_TOKEN=${HF_TOKEN}" \ --dry-run=client -o yaml | kubectl apply -f - -
Create a secret containing your s3 credentials
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY.kubectl create secret generic s3-secret \ --namespace ${NAMESPACE} \ --from-literal="AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" \ --from-literal="AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" \ --dry-run=client -o yaml | kubectl apply -f - -
Give the tasks needed permissions
envsubst '$NAMESPACE' < tekton/roles.yaml | kubectl apply -f -
oc adm policy add-scc-to-user anyuid -z default -n $NAMESPACE -
Create RWX PVC
model-pvc(300Gi) anddata-pvc(20Gi) andsource-pvc(20Gi) for storing models and execution results, respectively. These PVC is shared between all tasks. For example:export PVC_NAME=model-pvc export PVC_SIZE=300Gi
export PVC_NAME=data-pvc export PVC_SIZE=20Gi
export PVC_NAME=source-pvc export PVC_SIZE=20Gi
cat <<EOF | kubectl apply -f - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: ${PVC_NAME} namespace: ${NAMESPACE} spec: accessModes: - ReadWriteMany resources: requests: storage: ${PVC_SIZE} # storageClassName: ocs-storagecluster-cephfs volumeMode: Filesystem EOF
-
Install
tkncli:brew install tektoncd-cli
-
Deploy the steps and tasks:
for step in tekton/steps/*.yaml; do kubectl apply -f $step done for task in tekton/tasks/*.yaml; do kubectl apply -f $task done
-
Build and deploy the pipeline:
python tektonc/tektonc.py \ -t tektoncsample/prefix-caching/pipeline.yaml.j2 \ -f tektoncsample/prefix-caching/values.yaml \ -r tektoncsample/prefix-caching/pipelinerun.yaml \ -o tektoncsample/prefix-caching/pipeline.yaml kubectl apply -f tektoncsample/prefix-caching/pipeline.yaml
-
Deploy the PipelineRun.
Run the pipeline by deploying the PipelineRun:
kubectl apply -f tektoncsample/prefix-caching/pipelinerun.yaml
export EXPERIMENT_ID= export NAMESPACE= envsubst < tektoncsample/prefix-caching/pipelinerun.yaml | kubectl apply -f -
See the PipelineRun object created:
tkn pr listSee the TaskRun objects created:
tkn tr listSee the logs for a TaskRun:
tkn tr logs <taskrun_name> -fDescribe a TaskRun:
tkn tr describe <taskrun_name>Delete the PipelineRun:
tkn pr delete <pipelinerun_name> -f