Tekton - CI/CD in K8s
Install Tekton:
❯ kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
❯ kubectl get pods --namespace tekton-pipelines
Install Tekton CLI:
❯ brew tap tektoncd/tools
❯ brew install tektoncd/tools/tektoncd-cli
Create simple a task in file task-hello-world.yml
:
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello
spec:
steps:
- name: hello
image: ubuntu
command:
- echo
args:
- "Hello World!"
Apply task:
❯ kubectl apply -f task-hello-world.yml
Show task:
❯ tkn task list
NAME DESCRIPTION AGE
hello 35 seconds ago
❯ tkn task start hello --dry-run
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
creationTimestamp: null
generateName: hello-run-
namespace: tekton-pipelines
spec:
resources: {}
serviceAccountName: ""
taskRef:
name: hello
status:
podName: ""
Start task:
❯ tkn task start hello
TaskRun started: hello-run-zsqm4
❯ tkn taskrun logs hello-run-zsqm4 -f -n tekton-pipelines
[hello] Hello World!
❯ tkn taskrun logs --last -f
[hello] Hello World!
Create dashboard:
kubectl apply --filename https://github.com/tektoncd/dashboard/releases/latest/download/tekton-dashboard-release.yaml
kubectl proxy --port=8080
Access dashboard localhost:8080/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/ or use port forwarding to access dashboard on localhost:9097:
kubectl --namespace tekton-pipelines port-forward svc/tekton-dashboard 9097:9097