logo
Alauda DevOps Pipelines Docs
logo
Alauda DevOps Pipelines Docs
Navigation

Overview

Introduction
Architecture
Feature Overview
Lifecycle Policy
Quick Start
Release Notes

Concepts

TektonConfig
TektonPipeline
Install
Upgrade

Configure

Adjusting Optional Configuration Items of Subcomponents
Configuring Resource Quotas for Pipeline Components
Pod Template Configuration Guide
Regular Cleanup of TaskRun and PipelineRun Resources

How To

Deploying tekton-pipelines in a global cluster through TektonConfig

Pipelines

Introduction
Architecture

Concepts

Tasks
TaskRuns
Pipelines
PipelineRuns
StepActions
Resolvers
Workspaces
Pod Templates
Quick Start
permissions

how_to

Adjust Dockerfile for Building Task-Compatible Custom Images

trouble_shooting

Failed to create pod due to config error when using custom images in Tekton

Triggers

Introduction
Architecture

Core Concepts

Core Concepts
EventListener
Trigger
Interceptor
TriggerBinding
TriggerTemplate
Quick Start

How To

Setup EventListener
Use GitLab Event Triggers
Create TriggerTemplate

Troubleshooting

The Pipeline is not automatically triggered
Permission Description

Hub

Introduction
Architecture

Core Concepts

Concepts
Understanding Tekton Hub
Permission Description

Configure

Tekton Hub Configuration
Adding Custom Catalogs

Tutorials

Creating a Custom Catalog
Writing Tasks for Tekton Hub
Writing Pipelines for Tekton Hub

Results

Introduction
Architecture

Concepts

Core Concepts
Tekton Results
Quick Start
permissions

Configure

Database Configuration

Supply Chain Security

Introduction
Architecture

Concepts

Core Concepts
Understanding Tekton Chains
Quick Start

API Reference

Introduction

Kubernetes APIs

Pipelines

Pipeline [tekton.dev/v1]
Task [tekton.dev/v1]
PipelineRun [tekton.dev/v1]
TaskRun [tekton.dev/v1]
ClusterTask [tekton.dev/v1]
Run [tekton.dev/v1]
CustomRun [tekton.dev/v1]
StepAction [tekton.dev/v1]
VerificationPolicy [tekton.dev/v1alpha1]
ResolutionRequest [resolution.tekton.dev/v1beta1]

Triggers

Trigger [triggers.tekton.dev/v1beta1]
TriggerTemplate [triggers.tekton.dev/v1beta1]
EventListener [triggers.tekton.dev/v1beta1]
TriggerBinding [triggers.tekton.dev/v1beta1]
Interceptor [triggers.tekton.dev/v1alpha1]
ClusterTriggerBinding [triggers.tekton.dev/v1beta1]
ClusterInterceptor [triggers.tekton.dev/v1alpha1]

Operator

TektonConfig [operator.tekton.dev/v1alpha1]
TektonInstallerSet [operator.tekton.dev/v1alpha1]
TektonPipeline [operator.tekton.dev/v1alpha1]
TektonTrigger [operator.tekton.dev/v1alpha1]
TektonChain [operator.tekton.dev/v1alpha1]
TektonHub [operator.tekton.dev/v1alpha1]
TektonResult [operator.tekton.dev/v1alpha1]
TektonInstallerSet [operator.tekton.dev/v1alpha1]
OpenShift Pipelines as Code [operator.tekton.dev/v1alpha1]

Advanced APIs

Results

Introduction to API Usage
Results List
Results Details
Result records List
Result logs List
📝 Edit this page on GitHub
Previous PageAdjusting Optional Configuration Items of Subcomponents
Next PagePod Template Configuration Guide

#Configuring Resource Quotas for Pipeline Components

#TOC

#Overview

Configure resource quotas related to the Pipeline component.

#Use Cases

  • Adjust the resource quotas for the Pipeline component
  • Set default resource quotas for init-containers and containers created by TaskRun

#Prerequisites

  • The Tekton Operator component must be installed
  • TektonConfig resources must have been automatically created in the environment
  • The document on Adjusting Optional Configuration Items for Subcomponents should be read

#Resource Configuration Guidelines

Before configuring resource quotas:

  • Assess your cluster's available resources and capacity
  • Consider your workload characteristics and performance requirements
  • Start with conservative values and adjust based on monitoring data
  • Test configurations in non-production environments first

#Steps

#Step 1

Edit the TektonConfig resource

$ kubectl edit tektonconfigs.operator.tekton.dev config

#Step 2

WARNING

Modifying the configuration may trigger a rolling update of the component Pods, which could lead to temporary service unavailability. Please execute this at an appropriate time.

Example of modifying the spec.pipeline.options.deployments configuration:

apiVersion: operator.tekton.dev/v1alpha1
kind: TektonConfig
metadata:
  name: config
spec:
  pipeline:
    options:
      disabled: false

      configMaps:
        config-defaults:
          data:
            # Add default container resource quotas
            # Adjust the values below according to your cluster's resource capacity and workload requirements
            default-container-resource-requirements: |
              place-scripts: # updates resource requirements of a 'place-scripts' container
                requests:
                  memory: "<MEMORY_REQUEST>"  # e.g., "128Mi"
                  cpu: "<CPU_REQUEST>"        # e.g., "250m"
                limits:
                  memory: "<MEMORY_LIMIT>"    # e.g., "512Mi"
                  cpu: "<CPU_LIMIT>"          # e.g., "500m"

              prepare: # updates resource requirements of a 'prepare' container
                requests:
                  memory: "<MEMORY_REQUEST>"  # e.g., "128Mi"
                  cpu: "<CPU_REQUEST>"        # e.g., "250m"
                limits:
                  memory: "<MEMORY_LIMIT>"    # e.g., "256Mi"
                  cpu: "<CPU_LIMIT>"          # e.g., "500m"

              working-dir-initializer: # updates resource requirements of a 'working-dir-initializer' container
                requests:
                  memory: "<MEMORY_REQUEST>"  # e.g., "128Mi"
                  cpu: "<CPU_REQUEST>"        # e.g., "250m"
                limits:
                  memory: "<MEMORY_LIMIT>"    # e.g., "512Mi"
                  cpu: "<CPU_LIMIT>"          # e.g., "500m"

              prefix-scripts: # updates resource requirements of containers which starts with 'scripts-'
                requests:
                  memory: "<MEMORY_REQUEST>"  # e.g., "128Mi"
                  cpu: "<CPU_REQUEST>"        # e.g., "250m"
                limits:
                  memory: "<MEMORY_LIMIT>"    # e.g., "512Mi"
                  cpu: "<CPU_LIMIT>"          # e.g., "500m"

              prefix-sidecar-scripts: # updates resource requirements of containers which starts with 'sidecar-scripts-'
                requests:
                  memory: "<MEMORY_REQUEST>"  # e.g., "128Mi"
                  cpu: "<CPU_REQUEST>"        # e.g., "250m"
                limits:
                  memory: "<MEMORY_LIMIT>"    # e.g., "512Mi"
                  cpu: "<CPU_LIMIT>"          # e.g., "500m"

              sidecar-tekton-log-results: # updates resource requirements of a 'sidecar-tekton-log-results' container
                requests:
                  memory: "<MEMORY_REQUEST>"  # e.g., "128Mi"
                  cpu: "<CPU_REQUEST>"        # e.g., "100m"
                limits:
                  memory: "<MEMORY_LIMIT>"    # e.g., "256Mi"
                  cpu: "<CPU_LIMIT>"          # e.g., "250m"

      deployments:
        # Adjust the resource values below according to your cluster's capacity and performance requirements
        tekton-pipelines-controller:
          spec:
            replicas: <REPLICA_COUNT>  # e.g., 1
            template:
              spec:
                containers:
                  - name: tekton-pipelines-controller
                    resources:
                      requests:
                        cpu: <CPU_REQUEST>        # e.g., "500m"
                        memory: <MEMORY_REQUEST>  # e.g., "512Mi"
                      limits:
                        cpu: <CPU_LIMIT>          # e.g., "1"
                        memory: <MEMORY_LIMIT>    # e.g., "1Gi"

        tekton-pipelines-remote-resolvers:
          spec:
            replicas: <REPLICA_COUNT>  # e.g., 1
            template:
              spec:
                containers:
                  - name: controller
                    resources:
                      requests:
                        cpu: <CPU_REQUEST>        # e.g., "200m"
                        memory: <MEMORY_REQUEST>  # e.g., "256Mi"
                      limits:
                        cpu: <CPU_LIMIT>          # e.g., "500m"
                        memory: <MEMORY_LIMIT>    # e.g., "512Mi"

        tekton-pipelines-webhook:
          spec:
            replicas: <REPLICA_COUNT>  # e.g., 1
            template:
              spec:
                containers:
                  - name: webhook
                    resources:
                      requests:
                        cpu: <CPU_REQUEST>        # e.g., "500m"
                        memory: <MEMORY_REQUEST>  # e.g., "256Mi"
                      limits:
                        cpu: <CPU_LIMIT>          # e.g., "1"
                        memory: <MEMORY_LIMIT>    # e.g., "500Mi"

        tekton-events-controller:
          spec:
            replicas: <REPLICA_COUNT>  # e.g., 1
            template:
              spec:
                containers:
                  - name: tekton-events-controller
                    resources:
                      requests:
                        cpu: <CPU_REQUEST>        # e.g., "100m"
                        memory: <MEMORY_REQUEST>  # e.g., "100Mi"
                      limits:
                        cpu: <CPU_LIMIT>          # e.g., "200m"
                        memory: <MEMORY_LIMIT>    # e.g., "256Mi"

#Step 3

Submit the configuration and wait for the Pods to update.

$ kubectl get pods -n tekton-pipelines -w

NAME                                                    READY   STATUS    RESTARTS   AGE
tekton-pipelines-controller-648d87488b-fq9bc            1/1     Running   0          2m21s
tekton-pipelines-remote-resolvers-79554f5959-cbm6x      1/1     Running   0          2m21s
tekton-pipelines-webhook-5cd9847998-864zf               1/1     Running   0          2m20s
tekton-events-controller-5c97b7554c-m59m6               1/1     Running   0          2m21s

#Operation Result

You can see that the resource quota configurations for the Pipeline related components are effective.

$ kubectl get deployments.apps -n tekton-pipelines tekton-pipelines-controller tekton-pipelines-remote-resolvers tekton-pipelines-webhook tekton-events-controller -o yaml | grep 'resources:' -A 6

          resources:
            limits:
              cpu: "1"
              memory: 1Gi
            requests:
              cpu: 500m
              memory: 512Mi
--
          resources:
            limits:
              cpu: 500m
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 256Mi
--
          resources:
            limits:
              cpu: "2"
              memory: 500Mi
            requests:
              cpu: "1"
              memory: 256Mi
--
          resources:
            limits:
              cpu: 200m
              memory: 256Mi
            requests:
              cpu: 100m
              memory: 100Mi

#Verifying Pod Resource Quota Configuration

#Create a TaskRun

$ cat <<'EOF' | kubectl create -f -
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
  name: hello
  namespace: default
spec:
  taskSpec:
    steps:
      - name: hello
        image: alpine
        command: ["echo", "hello"]
EOF

#Wait for the TaskRun to Complete

$ kubectl get taskruns.tekton.dev -n default hello

NAME    SUCCEEDED   REASON      STARTTIME   COMPLETIONTIME
hello   True        Succeeded   2m41s       2m28s

#View the Pod Resource Quota Configuration

$ kubectl get pods -n default hello-hello-pod -o yaml

apiVersion: v1
kind: Pod
metadata:
  name: hello-pod
  namespace: default
spec:
  containers:
    - image: alpine
      name: step-hello
      resources: {}
  initContainers:
    - name: prepare
      resources:
        limits:
          cpu: 100m
          memory: 256Mi
        requests:
          cpu: 50m
          memory: 64Mi

You can see that the resource quota for the initContainers container prepare in the Pod matches the resource quotas configured in the config-defaults ConfigMap.

#References

  • Official Documentation: Configuring Default Resource Requirements
  • Related Code