Created
May 12, 2021 10:37
-
-
Save vfarcic/633004d16587ba230fe4dbbcf97adf7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################### | |
# Tekton # | |
# Kubernetes Cloud-Native CI/CD Pipelines And Workflows # | |
# https://youtu.be/7mvrpxz_BfE # | |
######################################################### | |
# Referenced videos: | |
# - Argo Workflows and Pipelines - CI/CD, Machine Learning, and Other Kubernetes Workflows: https://youtu.be/UMaivwrAyTA | |
# - Automation of Everything - How To Combine Argo Events, Workflows & Pipelines, CD, and Rollouts: https://youtu.be/XNXJtxkUKeY | |
# - Kaniko - Building Container Images In Kubernetes Without Docker: https://youtu.be/EgwVQN6GNJg | |
######### | |
# Setup # | |
######### | |
# Create a Kubernetes cluster with NGINX Ingress (https://kubernetes.github.io/ingress-nginx/deploy/) | |
# If NOT EKS | |
export INGRESS_HOST=$(kubectl \ | |
--namespace ingress-nginx \ | |
get svc ingress-nginx-controller \ | |
--output jsonpath="{.status.loadBalancer.ingress[0].ip}") | |
# If EKS | |
export INGRESS_HOSTNAME=$(kubectl \ | |
--namespace ingress-nginx \ | |
get svc ingress-nginx-controller \ | |
--output jsonpath="{.status.loadBalancer.ingress[0].hostname}") | |
# If EKS | |
export INGRESS_HOST=$(\ | |
dig +short $INGRESS_HOSTNAME) | |
echo $INGRESS_HOST | |
# Repeat the `export` commands if the output of the `echo` command is empty | |
# If the output contains more than one IP, wait for a while longer, and repeat the `export` commands. | |
# If the output continues having more than one IP, choose one of them and execute `export INGRESS_HOST=[...]` with `[...]` being the selected IP. | |
# Install `tkn` by following the instructions from the *Set up the CLI* section in https://tekton.dev/docs/getting-started/ | |
git clone https://github.com/vfarcic/tekton-demo.git | |
cd tekton-demo | |
kubectl apply \ | |
--filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml | |
kubectl apply \ | |
--filename https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml | |
kubectl apply \ | |
--filename https://storage.googleapis.com/tekton-releases/dashboard/latest/tekton-dashboard-release.yaml | |
export BASE_HOST=$INGRESS_HOST.nip.io | |
cat ingress.yaml \ | |
| sed -e "[email protected]@tekton.$BASE_HOST@g" \ | |
| kubectl \ | |
--namespace tekton-pipelines \ | |
apply --filename - | |
export REGISTRY_SERVER=https://index.docker.io/v1/ | |
# Replace `[...]` with the registry username | |
export REGISTRY_USER=[...] | |
# Replace `[...]` with the registry password | |
export REGISTRY_PASS=[...] | |
# Replace `[...]` with the registry email | |
export REGISTRY_EMAIL=[...] | |
kubectl create namespace tekton-builds | |
kubectl --namespace tekton-builds \ | |
create secret \ | |
docker-registry regcred \ | |
--docker-server=$REGISTRY_SERVER \ | |
--docker-username=$REGISTRY_USER \ | |
--docker-password=$REGISTRY_PASS \ | |
--docker-email=$REGISTRY_EMAIL | |
kubectl create namespace staging | |
kubectl create namespace production | |
################ | |
# Tekton tasks # | |
################ | |
cat silly.yaml | |
#################### | |
# Tekton pipelines # | |
#################### | |
cat parallel.yaml | |
cat cd.yaml | |
kubectl apply --filename cd.yaml | |
kubectl --namespace tekton-builds \ | |
get pipelines | |
############################ | |
# Running Tekton pipelines # | |
############################ | |
tkn --namespace tekton-builds \ | |
pipeline start toolkit \ | |
--dry-run | |
cat cd-run.yaml | |
kubectl create --filename cd-run.yaml | |
tkn --namespace tekton-builds \ | |
pipelinerun list | |
tkn --namespace tekton-builds \ | |
pipelinerun logs --last --follow | |
kubectl --namespace tekton-builds \ | |
get pods | |
################# | |
# Tekton Web UI # | |
################# | |
echo http://tekton.$BASE_HOST | |
# Open the URL | |
################### | |
# Handling events # | |
################### | |
# Open https://github.com/tektoncd/triggers/blob/main/docs/getting-started/README.md | |
# Open https://github.com/tektoncd/triggers/blob/main/docs/getting-started/create-ingress.yaml | |
# Open https://github.com/tektoncd/triggers/blob/main/docs/getting-started/create-webhook.yaml | |
# Open https://github.com/tektoncd/experimental/blob/main/webhooks-extension/docs/GettingStarted.md | |
# Open https://github.com/tektoncd/triggers/tree/v0.10.1/examples/github | |
# Open https://github.com/tektoncd/dashboard/blob/main/docs/extensions.md | |
############## | |
# Tekton Hub # | |
############## | |
# Open https://hub.tekton.dev/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment