cli icon indicating copy to clipboard operation
cli copied to clipboard

Tkn (in POD) cannot find pipeline resources although they exist

Open johan974 opened this issue 1 year ago • 1 comments

Expected Behavior

When starting the tkn at the command line for starting a pipeline in the test namespace, everything is ok. The command is:

$ tkn -n test pipeline start postsync-pipeline --param pause-duration="2" --showlog

PipelineRun started: postsync-pipeline-run-jzfvf
Waiting for logs to be available...
[first-task : say-it] Text one
[second-task : say-it] Text two

Actual Behavior

When running the tkn within a seperate POD, I get this error message:

Error: Pipeline name postsync-pipeline does not exist in namespace test

What is the Deployment? Notice that I also tried the official Docker image (based on this file Dockerfile ).

apiVersion: apps/v1
kind: Deployment
metadata:
  name: tkncli
  namespace: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tkncli
  template:
    metadata:
      labels:
        app: tkncli
    spec:
      containers:
        - name: tkncli
          image: quay.io/rhcanada/tkn-cli
          imagePullPolicy: IfNotPresent
          command:
            - tkn
          args:
            - -n
            - test
            - pipeline
            - start
            - postsync-pipeline
            - --param
            - pause-duration="2"

OK, what about the resources, are they really in the test namespace? Yes.

$ k get pipeline -n test
NAME                AGE
postsync-pipeline   24m

$ k get task -n test
NAME            AGE
postsync-task   12m

I also tried to leave the namespace out of the Deployment. No change.

Some further info:

  • Kubernetes version: v1.28.2

  • Tekton Pipeline version: v0.53.0

  • Operating System: Win 11, Docker Desktop envir.

Steps to Reproduce the Problem

  1. k apply the 3 files: deployment (above) and the pipeline and task below.
  2. You will see in the POD log the error message.

Additional Info

The pipeline:

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: postsync-pipeline
spec:
  params:
    - name: pause-duration
      description: pause interval
      type: string
      default: "2"
  tasks:
    - name: first-task
      taskRef:
        name: postsync-task
      params:
        - name: pause-duration
          value: $(params.pause-duration)
        - name: say-what
          value: "Text one"
    - name: second-task
      taskRef:
        name: postsync-task
      params:
        - name: pause-duration
          value: $(params.pause-duration)
        - name: say-what
          value: "Text two"

The task:

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: postsync-task
spec:
  params:
    - name: pause-duration
      description: How long to wait before saying something
      default: "0"
      type: string
    - name: say-what
      description: What should I say
      default: hello
      type: string
  steps:
    - name: say-it
      image: registry.access.redhat.com/ubi8/ubi
      command:
        - /bin/bash
      args: ['-c', 'sleep $(params.pause-duration) && echo $(params.say-what)']

johan974 avatar Dec 20 '23 17:12 johan974

@johan974, was your RBAC in place?

vinamra28 avatar May 21 '24 12:05 vinamra28