Setup

CLI tools

The following CLI tools are required for running the exercises in this tutorial. Please have them installed and configured before you get started with any of the tutorial chapters.

Tool macOS Fedora windows

Git

Download

Download

Download

Docker

Docker for Mac

dnf install docker

Docker for Windows

Minikube

https://minikube.sigs.k8s.io/docs/start/

https://minikube.sigs.k8s.io/docs/start/

https://minikube.sigs.k8s.io/docs/start/

kubectl

Install

Install

Install

stern

brew install stern

Download

Download

yqv4.x

brew install yq@4

brew install yq@4

choco install yq@4

httpie

brew install httpie

dnf install httpie

https://httpie.org/doc#windows-etc

watch

brew install watch

dnf install procps-ng

Download Tutorial Sources

Before we start setting up the environment, let’s clone the tutorial sources and set the TUTORIAL_HOME environment variable to point to the root directory of the tutorial:

Before we start setting up the environment, let’s clone the tutorial sources and set the TUTORIAL_HOME environment variable to point to the root directory of the tutorial:

export TUTORIAL_HOME="$(pwd)/tekton-tutorial"
cd $TUTORIAL_HOME

This tutorial was developed and tested with:

  • Tekton v0.24.3

  • Tekton Triggers v0.14.2

  • Minikube v1.25.0

  • OpenShift 4.8

  • Tekton CLI 0.19.0

  • Knative Client(kn) v0.17.3

Choose your Kubernetes Cluster

Knative can be installed only on Kubernetes cluster. The following section shows how to install Knative on vanilla Kubernetes or on Red Hat Openshift — an enterprise grade Kubernetes platform — 

  • Minikube

  • OpenShift

Configure and Start Minikube

Before installing Knative and its components, we need to create a Minikube virtual machine and deploy Kubernetes into it.

Download minikube and add it to your path.

$TUTORIAL_HOME/bin/start-minikube.sh
Minikube starting
πŸ˜„  [tektontutorial] minikube v1.25.0 on Darwin 11.1
✨  Using the hyperkit driver based on user configuration
πŸ‘  Starting control plane node tektontutorial in cluster tektontutorial
πŸ”₯  Creating hyperkit VM (CPUs=6, Memory=8192MB, Disk=51200MB) ...
🐳  Preparing Kubernetes v1.23.3 on Docker 20.10.2 ...
    > kubelet.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubectl.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubeadm.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubectl: 41.98 MiB / 41.98 MiB [---------------] 100.00% 1.10 MiB p/s 38s
    > kubeadm: 37.96 MiB / 37.96 MiB [-----------] 100.00% 450.47 KiB p/s 1m26s
    > kubelet: 108.01 MiB / 108.01 MiB [---------] 100.00% 822.97 KiB p/s 2m14s
πŸ”Ž  Verifying Kubernetes components...
🌟  Enabled addons: default-storageclass, storage-provisioner
πŸ„  Done! kubectl is now configured to use "tektontutorial" by default

Enable Internal Container Registry and Registry Aliases

To enable pushing and pulling container images from local internal minikube registry, we will deploy the minikube registry addon:

minikube addons enable registry
πŸ”Ž  Verifying registry addon...
🌟  The 'registry' addon is enabled
minikube addons enable registry-aliases
🌟  The 'registry-aliases' addon is enabled

The registry-aliases addon should allow you to build local container images with names like:

  • example.com/foo/bar

  • example.org/foo/bar

  • test.com/foo/bar

  • test.org/foo/bar

Now, let’s configure these registry-aliases in minikube by running the following:

Next, we should patch the core dns configuration of minikube and we can use the following set of commands:

The images build with the example.org, example.com, test.com and test.org will then be pushed and pulled from local internal registry, which was enable using minkube registry addon.

Deploy Tekton Pipelines

To deploy the Tekton pipelines:

It will take few mins for the Tekton pipeline components to be installed, you an watch the status using the command:

watch kubectl get pods -n tekton-pipelines

You can use Ctrl+c to terminate the watch

A successful deployment of Tekton pipelines will show the following pods:

NAME                                           READY   STATUS    AGE
tekton-pipelines-controller-849ccccd7f-gc6dp   1/1     Running   85s
tekton-pipelines-webhook-75bc7666c-9crwq       1/1     Running   85s

Install Tekton CLI

Tekton CLI is command line utility used to interact with the Tekton resources.

Download the Tekton cli and add to your path:

Verify the Tekton cli

tkn version

The command should show a result like:

Client version: 0.19.0
Pipeline version: v0.24.3
Since Tekton Triggers is not installed, the version is shown as unknown

Configuring Kubernetes namespace

All the tutorial exercises will be deployed in namespace called tektontutorial:

kubectl create namespace tektontutorial &&\
kubectl config set-context --current --namespace=tektontutorial

The following section details on how to install OpenShift Pipelines(Tekton on OpenShift).

  • Login as Cluster Admin

Login to OpenShift console using the cluster admin credentials. Follow the OpenShift Documentation to have OpenShift Pipelines installed in your OpenShift cluster.

Unless and until explictiy quoted, all the tutorial exercises will be deployed in namespace called tektontutorial:

oc new-project tektontutorial

You have now installed all the OpenShift pipelines components to run the tutorial exercises.