Tutorial to run a basic pipeline using tektoncd/pipeline
This tutorial will run a basic pipeline which builds an image from source code, push it to dockerhub and deploy to the cluster.
-
kubectl apply --filename https://storage.googleapis.com/tekton-releases/latest/release.yaml
Assuming your minikube cluster is up with tektoncd/pipeline installed
git clone https://github.com/piyush-garg/tekton-tutorial.git
cd tekton-tutorial
vi prep/dockersecret.yaml
apiVersion: v1
kind: Secret
metadata:
name: docker-auth
annotations:
tekton.dev/docker-0: https://index.docker.io
type: kubernetes.io/basic-auth
data:
username:
password:
Set username and password
echo -n dockerHubUsername | base64
e.g.echo -n sthaha | base64
echo -n dockerHubPassword | base64 -w 0
-
kubectl apply -f resource-descriptors/dockersecret.yaml
-
kubectl apply -f resource-descriptors/serviceaccount.yaml
-
kubectl apply -f resource-descriptors/role.yaml
kubectl apply -f resource-descriptors/rolebinding.yaml
-
Edit the Pipeline Resource of Web Image and App image with your Docker Hub username.
vi resources/pipelineResourceImageWeb.yaml
Provide DockerHub username here
value: docker.io/DockerHubUsername/test-web
Do the same for pipelineResourceImageApp.yaml
-
kubectl apply -f resource-descriptors/pipelineResourceImageWeb.yaml
kubectl apply -f resource-descriptors/pipelineResourceImageApp.yaml
kubectl apply -f resource-descriptors/pipelineResourceGit.yaml
-
kubectl apply -f resource-descriptors/taskpush.yaml
kubectl apply -f resource-descriptors/taskdeploy.yaml
-
kubectl apply -f resource-descriptors/pipeline.yaml
kubectl apply -f resource-descriptors/pipelinerun.yaml
This will build both the app and web dockerfile, push to github and apply the kubernetes yaml for both web and app as specified in github-repo https://github.com/piyush-garg/test-go
It will create Deployment and Service for both web and app
-
kubectl get pods -w
Wait till both web and app pod are in running state.
Hit the service to access the application
curl $(minikube service web --url)