Last active
May 19, 2021 22:38
-
-
Save enriquesoto/1eec2927f6f0e8f9dce5bc400f492f78 to your computer and use it in GitHub Desktop.
Comandos
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
Prerequisitos | |
- Cluster Kubernetes (>=v1.15) minikube, GKE, azure, https://www.katacoda.com/courses/kubernetes/playground (riesgo de desconexión) | |
- Editor de código | |
- kubectl | |
- cli tekton: https://github.com/tektoncd/cli | |
- cuenta en docker hub o algún registry | |
- crear namespace tekton-cicd | |
- crear secreto tipo kubernetes.io/dockerconfigjson con tales credenciales en su cluster en el namespace | |
tekton-cicd. En el caso de docker-hub: | |
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 --namespace tekton-cicd \ | |
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 | |
########################### | |
# Paso extra, solo si se usa katacoda | |
########################### | |
git clone https://github.com/tektoncd/website | |
mkdir /mnt/data && kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml && \ | |
kubectl apply -f website/tutorials/katacoda/getting-started/src/tekton-katacoda/init.yaml && \ | |
kubectl delete configmap/config-artifact-pvc -n tekton-pipelines && \ | |
kubectl create configmap config-artifact-pvc --from-literal=storageClassName=manual -n tekton-pipelines | |
################### | |
# Instalar tekton y dashboard | |
################### | |
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml | |
kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/tekton-dashboard-release.yaml | |
# test | |
$tkn version | |
############### | |
# Clonar repo 1: Ejemplos básicos | |
############### | |
$git clone git@github.com:enriquesoto/handson-tekton.git | |
$code handson-tekton | |
$tkn task start hello --showlog | |
$tkn pipeline start <name> | |
################### | |
# Clonar repo 2: Full pipeline | |
################### | |
$git clone git@github.com:enriquesoto/tekton-demo.git | |
cd tekton-demo | |
cat parallel.yaml | |
cat cd.yaml | |
kubectl apply --filename cd.yaml | |
kubectl --namespace tekton-cicd \ | |
get pipelines | |
############################ | |
# Running Tekton pipelines # | |
############################ | |
tkn --namespace tekton-cicd \ | |
pipeline start toolkit \ | |
--dry-run | |
cat cd-run.yaml | |
kubectl create --filename cd-run.yaml | |
tkn --namespace tekton-cicd \ | |
pipelinerun list | |
tkn --namespace tekton-cicd \ | |
pipelinerun logs --last --follow | |
kubectl --namespace tekton-cicd \ | |
get pods | |
############## | |
# Tekton dashboard | |
############## | |
kubectl port-forward -n tekton-cicd --address=0.0.0.0 service/tekton-dashboard 8080:9097 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment