LoginSignup
3
2

More than 3 years have passed since last update.

TektonをMinikubeで試してみたメモ。前提知識としてKanikoを先に単体で試した方がよい。

準備

Minikubeを起動する。

minikube start

Tektonのインストール

Tektonをインストールする。

コマンド
kubectl apply --filename https://storage.googleapis.com/tekton-releases/latest/release.yaml
実行例
$ kubectl apply --filename https://storage.googleapis.com/tekton-releases/latest/release.yaml
namespace/tekton-pipelines created
podsecuritypolicy.policy/tekton-pipelines created
clusterrole.rbac.authorization.k8s.io/tekton-pipelines-admin created
serviceaccount/tekton-pipelines-controller created
clusterrolebinding.rbac.authorization.k8s.io/tekton-pipelines-controller-admin created
customresourcedefinition.apiextensions.k8s.io/clustertasks.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/images.caching.internal.knative.dev created
customresourcedefinition.apiextensions.k8s.io/pipelines.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/pipelineruns.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/pipelineresources.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/tasks.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/taskruns.tekton.dev created
service/tekton-pipelines-controller created
service/tekton-pipelines-webhook created
clusterrole.rbac.authorization.k8s.io/tekton-aggregate-edit created
clusterrole.rbac.authorization.k8s.io/tekton-aggregate-view created
configmap/config-artifact-bucket created
configmap/config-artifact-pvc created
configmap/config-defaults created
configmap/config-logging created
deployment.apps/tekton-pipelines-controller created
deployment.apps/tekton-pipelines-webhook created
$

Podが起動したことを確認する。

$ kubectl get pods --namespace tekton-pipelines
NAME                                          READY   STATUS    RESTARTS   AGE
tekton-pipelines-controller-599ddb449-n769h   1/1     Running   0          51s
tekton-pipelines-webhook-54bf676f54-xq9dh     1/1     Running   0          51s
$

Hello World Task

Tektonでは、Taskを定義し、TaskRunでTaskを実行する(TaskRunを作成するとPodが実行される)。

まずTaskを定義する。Taskの.spec.stepの定義はPodのContainerの定義と同じ。

echo-hello-world.yaml
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: echo-hello-world
spec:
  steps:
  - name: echo
    image: ubuntu
    command:
    - echo
    args:
    - "hello world"
kubectl apply -f echo-hello-world.yaml

TaskRunを作成する。

echo-hello-world-task-run.yaml
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
  name: echo-hello-world-task-run
spec:
  taskRef:
    name: echo-hello-world
kubectl apply -f echo-hello-world-task-run.yaml

Taskで定義した内容でPodが実行されたことを確認する。

$ kubectl get taskrun
NAME                        SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
echo-hello-world-task-run   True        Succeeded   10s         1s
$ kubectl get pod
NAME                                   READY   STATUS      RESTARTS   AGE
echo-hello-world-task-run-pod-1f159c   0/1     Completed   0          18s
$ kubectl logs echo-hello-world-task-run-pod-1f159c
hello world
$

TaskRunとTaskを削除。

kubectl delete taskrun echo-hello-world-task-run
kubectl delete task echo-hello-world

複数Step

Stepを複数定義して試す。

複数Stepを持つTaskを定義する。StepがPod内のコンテナとして順番に実行される。

date-multi-step.yaml
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: date-multi-step
spec:
  steps:
  - name: ubuntu
    image: ubuntu
    command:
    - sh
    - -c
    - |
      date
      sleep 10
      date
  - name: centos
    image: centos
    command:
    - sh
    - -c
    - |
      date
      sleep 10
      date
kubectl apply -f date-multi-step.yaml

TaskRunを作成する。

date-multi-step-task-run.yaml
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
  name: date-multi-step-task-run
spec:
  taskRef:
    name: date-multi-step
kubectl apply -f date-multi-step-task-run.yaml

Step毎に順番にコンテナが実行されたことを確認する。

$ kubectl get taskrun
NAME                       SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
date-multi-step-task-run   True        Succeeded   37s         4s
$ kubectl get pod
NAME                                  READY   STATUS      RESTARTS   AGE
date-multi-step-task-run-pod-7b2fe3   0/2     Completed   0          43s
$ kubectl logs date-multi-step-task-run-pod-7b2fe3
Error from server (BadRequest): a container name must be specified for pod date-multi-step-task-run-pod-7b2fe3, choose one of: [step-ubuntu step-centos] or one of the init containers: [step-credential-initializer-crmct step-place-tools]
$ kubectl logs date-multi-step-task-run-pod-7b2fe3 step-ubuntu
Wed Aug 14 01:42:25 UTC 2019
Wed Aug 14 01:42:35 UTC 2019
$ kubectl logs date-multi-step-task-run-pod-7b2fe3 step-centos
Wed Aug 14 01:42:35 UTC 2019
Wed Aug 14 01:42:45 UTC 2019
$

TaskRunとTaskを削除。

kubectl delete taskrun date-multi-step-task-run
kubectl delete task date-multi-step

DockerイメージをビルドするTask

続いて、InputとOutputを使ったTaskを作成してみる。KanikoでGitからDockerfileを取得してイメージをビルドしてDockerHubにPushするタスクを作成してみる。以下のリポジトリーからDockerfileを取得する。

認証情報の準備

DockerHubの認証情報は専用のアノテーションをつけたBasic認証タイプのSecretに格納する。このアノテーションをつけておくと、Taskの実行時に$HOME/.docker/config.jsonが自動生成される。

ユーザー名とパスワードをBase64エンコードした文字列を取得。

echo -n '<username>' | base64
echo -n '<password>' | base64

Secretを作成する。

basic-user-pass.yaml
apiVersion: v1
kind: Secret
metadata:
  name: basic-user-pass
  annotations:
    tekton.dev/docker-0: https://index.docker.io/v1/
type: kubernetes.io/basic-auth
data:
  username: <encoded username>
  password: <encoded password>
kubectl apply -f basic-user-pass.yaml

ServiceAccountを作成し、作成したBasic認証のSecretを関連づける。

build-bot.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: build-bot
secrets:
  - name: basic-user-pass
kubectl apply -f build-bot.yaml

Taskの定義

Taskを定義する。

build-docker-image.yaml
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: build-docker-image
spec:
  inputs:
    resources:
    - name: source-repo
      type: git
    params:
    - name: pathToDockerFile
      type: string
      description: The path to the dockerfile to build
      default: /workspace/source-repo/Dockerfile
    - name: pathToContext
      type: string
      description: The build context used by Kaniko
      default: /workspace/source-repo
  outputs:
    resources:
    - name: builtImage
      type: image
  steps:
  - name: build-and-push
    image: gcr.io/kaniko-project/executor:latest
    env:
    - name: "DOCKER_CONFIG"
      value: "/builder/home/.docker/"
    command:
    - /kaniko/executor
    args:
    - --dockerfile=${inputs.params.pathToDockerFile}
    - --destination=${outputs.resources.builtImage.url}
    - --context=${inputs.params.pathToContext}
kubectl apply -f build-docker-image.yaml

PipelineResourceの定義

TaskRunのInputとOutputとなるPipelineResourceを作成する。Inputに記載されたリソースはTask実行時に/workspaceの下にリソース名のディレクトリーの下に展開される仕様となっている。

kaniko-sample-git.yaml
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
  name: kaniko-sample-git
spec:
  type: git
  params:
  - name: url
    value: https://github.com/sotoiwa/kaniko-sample.git
tekton-sample-image
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
  name: tekton-sample-image
spec:
  type: image
  params:
  - name: url
    value: sotoiwa540/tekton-sample:1.0
kubectl apply -f kaniko-sample-git.yaml
kubectl apply -f tekton-sample-image.yaml

TaskRun

このTaskを実行するTaskRunを作成する。InputとOutputはPipelineResourceへの参照を書く。先ほど作成したServiceAccountを指定する。

build-docker-image-task-run.yaml
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
  name: build-docker-image-task-run
spec:
  serviceAccount: build-bot
  taskRef:
    name: build-docker-image
  inputs:
    resources:
    - name: source-repo
      resourceRef:
        name: kaniko-sample-git
    params:
    - name: pathToDockerFile
      value: /workspace/source-repo/Dockerfile
    - name: pathToContext
      value: /workspace/source-repo
  outputs:
    resources:
    - name: builtImage
      resourceRef:
        name: tekton-sample-image
kubectl apply -f build-docker-image-task-run.yaml

確認する。

$ kubectl get taskrun
NAME                          SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
build-docker-image-task-run   True        Succeeded   65s         41s
$ kubectl get po
NAME                                     READY   STATUS      RESTARTS   AGE
build-docker-image-task-run-pod-3b15af   0/3     Completed   0          76s
$ kubectl logs build-docker-image-task-run-pod-3b15af
Error from server (BadRequest): a container name must be specified for pod build-docker-image-task-run-pod-3b15af, choose one of: [step-git-source-kaniko-sample-git-t5xsd step-build-and-push step-image-digest-exporter-build-and-push-p99mb] or one of the init containers: [step-credential-initializer-j2mkt create-dir-default-image-output-8rwq9 step-place-tools]
$

InitContainerが以下の3つ動いている。

  • step-credential-initializer-jgrrj
  • create-dir-default-image-output-v5qsz
  • step-place-tools

Containerも以下の3つ動いている。

  • step-git-source-kaniko-sample-git-fk8z5
  • step-build-and-push
  • step-image-digest-exporter-build-and-push-v8hdb

build-and-pushのステップを確認する。

$ kubectl logs build-docker-image-task-run-pod-3b15af step-build-and-push
INFO[0002] Resolved base name ubuntu to ubuntu
INFO[0002] Resolved base name ubuntu to ubuntu
INFO[0002] Downloading base image ubuntu
INFO[0004] Error while retrieving image from cache: getting file info: stat /cache/sha256:d91842ef309155b85a9e5c59566719308fab816b40d376809c39cf1cf4de3c6a: no such file or directory
INFO[0004] Downloading base image ubuntu
INFO[0006] Built cross stage deps: map[]
INFO[0006] Downloading base image ubuntu
INFO[0007] Error while retrieving image from cache: getting file info: stat /cache/sha256:d91842ef309155b85a9e5c59566719308fab816b40d376809c39cf1cf4de3c6a: no such file or directory
INFO[0007] Downloading base image ubuntu
INFO[0009] Skipping unpacking as no commands require it.
INFO[0009] Taking snapshot of full filesystem...
INFO[0009] CMD ["echo", "Hello World!!!"]
2019/08/14 02:23:22 existing blob: sha256:1d425c98234572d4221a1ac173162c4279f9fdde4726ec22ad3c399f59bb7503
2019/08/14 02:23:22 existing blob: sha256:0fe7e7cbb2e88617d969efeeb3bd3125f7d309335c736a0525233ec2dc06aee1
2019/08/14 02:23:22 existing blob: sha256:344da5c95cecd0f55238ce59b8469ee301056001ece2b769e9691b80f94f9f37
2019/08/14 02:23:22 existing blob: sha256:7413c47ba209e555018c4be91101d017737f24b0c9d1f65339b97a4da98acb2a
2019/08/14 02:23:23 pushed blob: sha256:77444067f67a7893ce9f22e98a3ed722336c22394662537ac45dff30efb33cc5
2019/08/14 02:23:23 index.docker.io/sotoiwa540/tekton-sample:1.0: digest: sha256:6a2afbd3d96fb18a7b6ea1ccc17c457eebecdff678b4914f5381aad6d0963d71 size: 911
$

TaskRunの内容を確認する。
kubectl get taskrun build-docker-image-task-run -o yaml
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"tekton.dev/v1alpha1","kind":"Task","metadata":{"annotations":{},"name":"build-docker-image","namespace":"default"},"spec":{"inputs":{"params":[{"default":"Dockerfile","description":"The path to the dockerfile to build","name":"pathToDockerFile","type":"string"},{"default":"/workspace/docker-source","description":"The build context used by Kaniko","name":"pathToContext","type":"string"}],"resources":[{"name":"docker-source","type":"git"}]},"outputs":{"resources":[{"name":"builtImage","type":"image"}]},"steps":[{"args":["--dockerfile=${inputs.params.pathToDockerFile}","--destination=${outputs.resources.builtImage.url}","--context=${inputs.params.pathToContext}"],"command":["/kaniko/executor"],"env":[{"name":"DOCKER_CONFIG","value":"/builder/home/.docker/"}],"image":"gcr.io/kaniko-project/executor:latest","name":"build-and-push"}]}}
  creationTimestamp: "2019-08-14T02:23:00Z"
  generation: 1
  labels:
    tekton.dev/task: build-docker-image
  name: build-docker-image-task-run
  namespace: default
  resourceVersion: "35042"
  selfLink: /apis/tekton.dev/v1alpha1/namespaces/default/taskruns/build-docker-image-task-run
  uid: 47724103-529e-4898-8043-dffc74004551
spec:
  inputs:
    params:
    - name: pathToDockerFile
      value: Dockerfile
    - name: pathToContext
      value: /workspace/docker-source
    resources:
    - name: docker-source
      resourceRef:
        name: kaniko-sample-git
  outputs:
    resources:
    - name: builtImage
      resourceRef:
        name: tekton-sample-image
  serviceAccount: build-bot
  taskRef:
    kind: Task
    name: build-docker-image
  timeout: 1h0m0s
status:
  completionTime: "2019-08-14T02:23:24Z"
  conditions:
  - lastTransitionTime: "2019-08-14T02:23:24Z"
    message: All Steps have completed executing
    reason: Succeeded
    status: "True"
    type: Succeeded
  podName: build-docker-image-task-run-pod-3b15af
  startTime: "2019-08-14T02:23:00Z"
  steps:
  - name: build-and-push
    terminated:
      containerID: docker://50a89367fe5b48735c515598562ea16ee97f66c06fe148570cf8b64e6bc5a7f3
      exitCode: 0
      finishedAt: "2019-08-14T02:23:23Z"
      reason: Completed
      startedAt: "2019-08-14T02:23:06Z"
  - name: git-source-kaniko-sample-git-t5xsd
    terminated:
      containerID: docker://435948325cb4c91fe03a4aa6bc164de24835ffc3beea3446a0a1a4181ebb0ac6
      exitCode: 0
      finishedAt: "2019-08-14T02:23:10Z"
      reason: Completed
      startedAt: "2019-08-14T02:23:04Z"
  - name: image-digest-exporter-build-and-push-p99mb
    terminated:
      containerID: docker://7a765a9387ad28f34345b9d9d05944f0fceb049b17dcf6ffa54530da02901eb6
      exitCode: 0
      finishedAt: "2019-08-14T02:23:24Z"
      message: '[]'
      reason: Completed
      startedAt: "2019-08-14T02:23:06Z"

Podの内容を確認する。
kubectl get po build-docker-image-task-run-pod-3b15af -o yaml
apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"tekton.dev/v1alpha1","kind":"Task","metadata":{"annotations":{},"name":"build-docker-image","namespace":"default"},"spec":{"inputs":{"params":[{"default":"Dockerfile","description":"The path to the dockerfile to build","name":"pathToDockerFile","type":"string"},{"default":"/workspace/docker-source","description":"The build context used by Kaniko","name":"pathToContext","type":"string"}],"resources":[{"name":"docker-source","type":"git"}]},"outputs":{"resources":[{"name":"builtImage","type":"image"}]},"steps":[{"args":["--dockerfile=${inputs.params.pathToDockerFile}","--destination=${outputs.resources.builtImage.url}","--context=${inputs.params.pathToContext}"],"command":["/kaniko/executor"],"env":[{"name":"DOCKER_CONFIG","value":"/builder/home/.docker/"}],"image":"gcr.io/kaniko-project/executor:latest","name":"build-and-push"}]}}
    tekton.dev/ready: READY
  creationTimestamp: "2019-08-14T02:23:00Z"
  labels:
    tekton.dev/task: build-docker-image
    tekton.dev/taskRun: build-docker-image-task-run
  name: build-docker-image-task-run-pod-3b15af
  namespace: default
  ownerReferences:
  - apiVersion: tekton.dev/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: TaskRun
    name: build-docker-image-task-run
    uid: 47724103-529e-4898-8043-dffc74004551
  resourceVersion: "35040"
  selfLink: /api/v1/namespaces/default/pods/build-docker-image-task-run-pod-3b15af
  uid: 5060948b-7969-448c-8ece-0f8481c58146
spec:
  containers:
  - args:
    - -wait_file
    - /builder/downward/ready
    - -post_file
    - /builder/tools/0
    - -wait_file_content
    - -entrypoint
    - /ko-app/git-init
    - --
    - -url
    - https://github.com/sotoiwa/kaniko-sample.git
    - -revision
    - master
    - -path
    - /workspace/docker-source
    command:
    - /builder/tools/entrypoint
    env:
    - name: HOME
      value: /builder/home
    image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:2e5217266f515f91be333d5f8abcdc98bb1a7a4de7b339734e10fd7b972eeb5f
    imagePullPolicy: IfNotPresent
    name: step-git-source-kaniko-sample-git-t5xsd
    resources:
      requests:
        cpu: "0"
        ephemeral-storage: "0"
        memory: "0"
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /builder/tools
      name: tools
    - mountPath: /builder/downward
      name: downward
    - mountPath: /workspace
      name: workspace
    - mountPath: /builder/home
      name: home
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: build-bot-token-xz77w
      readOnly: true
    workingDir: /workspace
  - args:
    - -wait_file
    - /builder/tools/0
    - -post_file
    - /builder/tools/1
    - -entrypoint
    - /kaniko/executor
    - --
    - --dockerfile=Dockerfile
    - --destination=sotoiwa540/tekton-sample:1.0
    - --context=/workspace/docker-source
    command:
    - /builder/tools/entrypoint
    env:
    - name: HOME
      value: /builder/home
    - name: DOCKER_CONFIG
      value: /builder/home/.docker/
    image: gcr.io/kaniko-project/executor:latest
    imagePullPolicy: Always
    name: step-build-and-push
    resources:
      requests:
        cpu: "0"
        ephemeral-storage: "0"
        memory: "0"
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /builder/tools
      name: tools
    - mountPath: /workspace
      name: workspace
    - mountPath: /builder/home
      name: home
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: build-bot-token-xz77w
      readOnly: true
    workingDir: /workspace
  - args:
    - -wait_file
    - /builder/tools/1
    - -post_file
    - /builder/tools/2
    - -entrypoint
    - /ko-app/imagedigestexporter
    - --
    - -images
    - '[{"name":"tekton-sample-image","type":"image","url":"sotoiwa540/tekton-sample:1.0","digest":"","OutputImageDir":"/builder/home/image-outputs/builtImage"}]'
    - -terminationMessagePath
    - /builder/home/image-outputs/termination-log
    command:
    - /builder/tools/entrypoint
    env:
    - name: HOME
      value: /builder/home
    image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/imagedigestexporter@sha256:aae9c44ed56f0d30530a2349f255c4977a6d8d4a497dfdca626b51f35bf229b4
    imagePullPolicy: IfNotPresent
    name: step-image-digest-exporter-build-and-push-p99mb
    resources:
      requests:
        cpu: "0"
        ephemeral-storage: "0"
        memory: "0"
    terminationMessagePath: /builder/home/image-outputs/termination-log
    terminationMessagePolicy: FallbackToLogsOnError
    volumeMounts:
    - mountPath: /builder/tools
      name: tools
    - mountPath: /workspace
      name: workspace
    - mountPath: /builder/home
      name: home
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: build-bot-token-xz77w
      readOnly: true
    workingDir: /workspace
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  initContainers:
  - args:
    - -basic-docker=basic-user-pass=https://index.docker.io/v1/
    command:
    - /ko-app/creds-init
    env:
    - name: HOME
      value: /builder/home
    image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init@sha256:c0235af1723068e6806def1d998436cde5d93ff1c38a94b9c92410f5f01bcb26
    imagePullPolicy: IfNotPresent
    name: step-credential-initializer-j2mkt
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /workspace
      name: workspace
    - mountPath: /builder/home
      name: home
    - mountPath: /var/build-secrets/basic-user-pass
      name: secret-volume-basic-user-pass-4ljjg
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: build-bot-token-xz77w
      readOnly: true
    workingDir: /workspace
  - args:
    - -args
    - mkdir -p /builder/home/image-outputs/builtImage
    command:
    - /ko-app/bash
    image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/bash@sha256:157b21c4b29a4f2aa96d52add55781f211cc8101df36657b82089119b2fc4004
    imagePullPolicy: IfNotPresent
    name: create-dir-default-image-output-8rwq9
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /workspace
      name: workspace
    - mountPath: /builder/home
      name: home
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: build-bot-token-xz77w
      readOnly: true
  - args:
    - -c
    - cp /ko-app/entrypoint /builder/tools/entrypoint
    command:
    - /bin/sh
    env:
    - name: HOME
      value: /builder/home
    image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint@sha256:a424ab773b89e13e5e03ff90962db98424621b47c1bb543ec270783cfd859faf
    imagePullPolicy: IfNotPresent
    name: step-place-tools
    resources: {}
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /builder/tools
      name: tools
    - mountPath: /workspace
      name: workspace
    - mountPath: /builder/home
      name: home
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: build-bot-token-xz77w
      readOnly: true
    workingDir: /workspace
  nodeName: minikube
  priority: 0
  restartPolicy: Never
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: build-bot
  serviceAccountName: build-bot
  terminationGracePeriodSeconds: 30
  tolerations:
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  volumes:
  - emptyDir: {}
    name: tools
  - downwardAPI:
      defaultMode: 420
      items:
      - fieldRef:
          apiVersion: v1
          fieldPath: metadata.annotations['tekton.dev/ready']
        path: ready
    name: downward
  - emptyDir: {}
    name: workspace
  - emptyDir: {}
    name: home
  - name: secret-volume-basic-user-pass-4ljjg
    secret:
      defaultMode: 420
      secretName: basic-user-pass
  - name: build-bot-token-xz77w
    secret:
      defaultMode: 420
      secretName: build-bot-token-xz77w
status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2019-08-14T02:23:04Z"
    reason: PodCompleted
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2019-08-14T02:23:10Z"
    reason: PodCompleted
    status: "False"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2019-08-14T02:23:10Z"
    reason: PodCompleted
    status: "False"
    type: ContainersReady
  - lastProbeTime: null
    lastTransitionTime: "2019-08-14T02:23:00Z"
    status: "True"
    type: PodScheduled
  containerStatuses:
  - containerID: docker://50a89367fe5b48735c515598562ea16ee97f66c06fe148570cf8b64e6bc5a7f3
    image: gcr.io/kaniko-project/executor:latest
    imageID: docker-pullable://gcr.io/kaniko-project/executor@sha256:78d44ec4e9cb5545d7f85c1924695c89503ded86a59f92c7ae658afa3cff5400
    lastState: {}
    name: step-build-and-push
    ready: false
    restartCount: 0
    state:
      terminated:
        containerID: docker://50a89367fe5b48735c515598562ea16ee97f66c06fe148570cf8b64e6bc5a7f3
        exitCode: 0
        finishedAt: "2019-08-14T02:23:23Z"
        reason: Completed
        startedAt: "2019-08-14T02:23:06Z"
  - containerID: docker://435948325cb4c91fe03a4aa6bc164de24835ffc3beea3446a0a1a4181ebb0ac6
    image: sha256:139c86c9b834ee5835244b2828981ab2ff249362b10bc3b5c2a19165351eb79a
    imageID: docker-pullable://gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:2e5217266f515f91be333d5f8abcdc98bb1a7a4de7b339734e10fd7b972eeb5f
    lastState: {}
    name: step-git-source-kaniko-sample-git-t5xsd
    ready: false
    restartCount: 0
    state:
      terminated:
        containerID: docker://435948325cb4c91fe03a4aa6bc164de24835ffc3beea3446a0a1a4181ebb0ac6
        exitCode: 0
        finishedAt: "2019-08-14T02:23:10Z"
        reason: Completed
        startedAt: "2019-08-14T02:23:04Z"
  - containerID: docker://7a765a9387ad28f34345b9d9d05944f0fceb049b17dcf6ffa54530da02901eb6
    image: sha256:0457501ed02dc9572707e9f589950051166965e9e4e7774bfb647270a523156f
    imageID: docker-pullable://gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/imagedigestexporter@sha256:aae9c44ed56f0d30530a2349f255c4977a6d8d4a497dfdca626b51f35bf229b4
    lastState: {}
    name: step-image-digest-exporter-build-and-push-p99mb
    ready: false
    restartCount: 0
    state:
      terminated:
        containerID: docker://7a765a9387ad28f34345b9d9d05944f0fceb049b17dcf6ffa54530da02901eb6
        exitCode: 0
        finishedAt: "2019-08-14T02:23:24Z"
        message: '[]'
        reason: Completed
        startedAt: "2019-08-14T02:23:06Z"
  hostIP: 10.0.2.15
  initContainerStatuses:
  - containerID: docker://7ecc3076f3ef46619425c55aa63384ebf8ac5d127157a414c42c0818529cedfb
    image: sha256:3dd840c1360f484d6d74c74246b42a54f3c5a2c7fbb56be8686d2622286db9b6
    imageID: docker-pullable://gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/creds-init@sha256:c0235af1723068e6806def1d998436cde5d93ff1c38a94b9c92410f5f01bcb26
    lastState: {}
    name: step-credential-initializer-j2mkt
    ready: true
    restartCount: 0
    state:
      terminated:
        containerID: docker://7ecc3076f3ef46619425c55aa63384ebf8ac5d127157a414c42c0818529cedfb
        exitCode: 0
        finishedAt: "2019-08-14T02:23:01Z"
        reason: Completed
        startedAt: "2019-08-14T02:23:01Z"
  - containerID: docker://0761fb2b66a3ee8a5cd6a19d1f0a5c1bedc01fc1d2f3afe59fdd99dd06c3158b
    image: sha256:48f0a06204d17cc9c06c6801d7b01a47753ce4ac2981d5ee77c4261604705bc0
    imageID: docker-pullable://gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/bash@sha256:157b21c4b29a4f2aa96d52add55781f211cc8101df36657b82089119b2fc4004
    lastState: {}
    name: create-dir-default-image-output-8rwq9
    ready: true
    restartCount: 0
    state:
      terminated:
        containerID: docker://0761fb2b66a3ee8a5cd6a19d1f0a5c1bedc01fc1d2f3afe59fdd99dd06c3158b
        exitCode: 0
        finishedAt: "2019-08-14T02:23:02Z"
        reason: Completed
        startedAt: "2019-08-14T02:23:02Z"
  - containerID: docker://2b22625b25e0daa02e480ac9aa895440ea36fc387fe90286baf2e879ef576743
    image: sha256:112d4e770296890f51114df859615bde8d976e7856bba3f5f34b3e0c584a4688
    imageID: docker-pullable://gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint@sha256:a424ab773b89e13e5e03ff90962db98424621b47c1bb543ec270783cfd859faf
    lastState: {}
    name: step-place-tools
    ready: true
    restartCount: 0
    state:
      terminated:
        containerID: docker://2b22625b25e0daa02e480ac9aa895440ea36fc387fe90286baf2e879ef576743
        exitCode: 0
        finishedAt: "2019-08-14T02:23:03Z"
        reason: Completed
        startedAt: "2019-08-14T02:23:03Z"
  phase: Succeeded
  podIP: 172.17.0.7
  qosClass: BestEffort
  startTime: "2019-08-14T02:23:00Z"

TaskRun、PipelineResourceを削除。Taskは次のPipelineでも使うので残しておく。

kubectl delete taskrun build-docker-image-task-run
# kubectl delete task build-docker-image
kubectl delete pipelineresource kaniko-sample-git
kubectl delete pipelineresource tekton-sample-image

TODO

Taskを順番に実行するための定義がPipelineで、Pipelineを実行するのがPipelineRun。

参考リンク

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2