Updated for working with k3d 3.x
Prereqs:
- Assuming a Mac
- install k3d https://github.com/rancher/k3d
- Using Docker Desktop, must be installed and running
- kubectl, tkn installed
Setup:
- create a k3d cluster called
k3d-tekton-explore
or just thedefault
cluster name, like thisk3d cluster create k3d-tekton-explore
- If not already started, start the cluster with
k3d cluster start k3d-tekton-explore
and can be stopped withk3d stop k3d-tekton-explore
. You can see if a cluster is running withk3d cluster list
. - get the kubeconfig with
export KUBECONFIG=$(k3d kubeconfig merge k3d-tekton-explore --switch-context)
- create a k8s namespace that will be used when applying your pipeline yaml, I use
kc create namespace ckmason-demo
- install Tekton with
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
, I installed the v1beta1 version. These get installed into thetekton-pipelines
kube namespace - can verify with
kubectl get pods -n tekton-pipelines
- install the Tekton dashboard with
kubectl apply --filename https://github.com/tektoncd/dashboard/releases/download/v0.11.0/tekton-dashboard-release.yaml
- Use port forwarding to be able to see the Dashboard webui with
kubectl --namespace tekton-pipelines port-forward svc/tekton-dashboard 9097:9097&
(notice the trailing&
so it runs in the background) and then visitlocalhost:9097
in your browser. Make sure you are viewing the right namespace or all namespaces in the dashboard to see your PipeLineRuns and TaskRuns - You can also use the tkn cli to view PipeLineRuns and TaskRuns as well as logs
- I created some bash aliases for tkn and have them saved in my
~/.tkn_aliases.sh
file and they are sourced in my~/.bash_profile
.
# A set of alias for the Tekton cli, aka tkn https://github.com/tektoncd/cli#tekton-pipelines-cli
# Note that tkn needs to know the k8s namespace to use,
# thus it is a good idea to set it with:
# `kubectl config set-context --current --namespace=ckmason-demo`
alias prd='tkn pipelinerun describe'
alias prlgs='tkn pipelinerun logs'
alias prls='tkn pipelinerun ls'
alias prrm='tkn pipeline delete'
alias trd='tkn taskrun describe'
alias trlgs='tkn taskrun logs'
alias trls='tkn taskrun ls'
alias trrm='tkn taskrun delete'
Once the setup above is done, then you can finally can do something useful with a local cluster and Tekton.
Typically, this will mean creating various Tekton Pipeline and Task resources via yaml files and applying them with kubectl to your cluster and checking the results with the Tekton Dashboard or tkn cli.
Hi. I cannot create Tekton namespace with pod relatively, it shows the error is cannot pull image from gcr.io
do you have any idea about this issue?