<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: José Alberto Ruiz Casarrubios</title>
    <description>The latest articles on Forem by José Alberto Ruiz Casarrubios (@jaruizes).</description>
    <link>https://forem.com/jaruizes</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F597676%2Ffd2e27a4-ba1a-4d7a-b01b-6f0a6459feab.jpeg</url>
      <title>Forem: José Alberto Ruiz Casarrubios</title>
      <link>https://forem.com/jaruizes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jaruizes"/>
    <language>en</language>
    <item>
      <title>KUBERNETES - CI/CD WITH TEKTON &amp; ARGO CD</title>
      <dc:creator>José Alberto Ruiz Casarrubios</dc:creator>
      <pubDate>Tue, 16 Mar 2021 22:43:02 +0000</pubDate>
      <link>https://forem.com/jaruizes/kubernetes-ci-cd-with-tekton-argo-cd-1fm4</link>
      <guid>https://forem.com/jaruizes/kubernetes-ci-cd-with-tekton-argo-cd-1fm4</guid>
      <description>&lt;h1&gt;
  
  
  Kubernetes - CI/CD with Tekton &amp;amp; Argo CD
&lt;/h1&gt;

&lt;p&gt;With this post I'm going to show how a modern and cloud native CI/CD could be implemented within a Kubernetes environment. I'll use two different tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tekton&lt;/strong&gt;: to implement CI stages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Argo CD&lt;/strong&gt;: to implement CD stages (Gitops)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post doesn't try to be a master class about Tekton or Argo CD. It is only intended to set an starting point to explore both tools using them directly in a cluster. &lt;/p&gt;

&lt;p&gt;You can check and clone all the code associated to this article in my &lt;a href="https://github.com/jaruizes/tekton-argocd-poc" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  ¿Tekton?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tekton&lt;/strong&gt; is an Open Source framework to build CI/CD pipelines directly over a Kuberentes cluster. It was originally developed at Google and was known as &lt;em&gt;Knative&lt;/em&gt; pipelines&lt;/p&gt;

&lt;p&gt;Tekton defines a series of Kubernetes custom resources (CRDs) extending the Kubernetes API. Sorry, &lt;strong&gt;what that means?&lt;/strong&gt; Ok, if we go to the &lt;a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/" rel="noopener noreferrer"&gt;Kubernetes official page&lt;/a&gt;, we can read the following definition:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Kubernetes objects&lt;/em&gt; are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, examples of Kubernetes objects are: Pod, Service, Deployment, etc...&lt;strong&gt;Tekton builds its own objects to Kubernetes and deploys them into the cluster&lt;/strong&gt;. If you feel curious about custom objects, here &lt;a href="https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/" rel="noopener noreferrer"&gt;the official documentation&lt;/a&gt; is and you can also check the Tekton Github to see how these objects are. For instance, &lt;a href="https://github.com/tektoncd/pipeline/blob/master/config/300-pipeline.yaml" rel="noopener noreferrer"&gt;Pipeline&lt;/a&gt; or &lt;a href="https://github.com/tektoncd/pipeline/blob/master/config/300-task.yaml" rel="noopener noreferrer"&gt;Task&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  ¿Argo CD?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Argo CD&lt;/strong&gt; is a delivery tool (CD) built for Kubernetes, based on &lt;a href="https://www.cloudbees.com/gitops/what-is-gitops" rel="noopener noreferrer"&gt;GitOps movement&lt;/a&gt;. So, what that means? Basically that Argo CD works synchronizing "Kubernetes files" between a git repository and a Kubernetes cluster. That is, if there is a change in a YAML file, Argo CD will detect that there are changes and will try to apply those changes in the cluster. &lt;/p&gt;

&lt;p&gt;Argo CD, like Tekton, also creates &lt;a href="https://github.com/argoproj/argo-cd/tree/master/manifests/crds" rel="noopener noreferrer"&gt;its own Kubernetes custom resources&lt;/a&gt; that are installed into the Kubernetes cluster. &lt;/p&gt;


&lt;h2&gt;
  
  
  Are they ready to be adopted?
&lt;/h2&gt;

&lt;p&gt;At the moment in which this post is being written, both tools are very "young". For instance, if we check the last releases we can see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Argo CD&lt;/strong&gt;: 1.8.7&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tekton&lt;/strong&gt;: 0.21.0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also like to check ThoughtWorks Technology Radar...If we check them in the radar, will see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Argo CD&lt;/strong&gt;:  &lt;strong&gt;Trial status&lt;/strong&gt; (&lt;a href="https://www.thoughtworks.com/radar/platforms/argo-cd" rel="noopener noreferrer"&gt;Vol. 22&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tekton&lt;/strong&gt;:  &lt;strong&gt;Assess status&lt;/strong&gt; (&lt;a href="https://www.thoughtworks.com/radar/platforms/tekton" rel="noopener noreferrer"&gt;Vol. 23&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, we are facing two young platforms and that may imply that there are not many examples, documentation or even maturity failures, but it's true that both tools are called to be the standard cloud native CI/CD according to the principal cloud players.&lt;/p&gt;

&lt;p&gt;For instance, &lt;strong&gt;Tekton&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google Cloud&lt;/strong&gt;: &lt;a href="https://cloud.google.com/tekton?hl=es" rel="noopener noreferrer"&gt;https://cloud.google.com/tekton?hl=es&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Red Hat&lt;/strong&gt;, Openshift Pipelines based on Tekton: (&lt;a href="https://www.openshift.com/learn/topics/pipelines" rel="noopener noreferrer"&gt;https://www.openshift.com/learn/topics/pipelines&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IBM&lt;/strong&gt;: &lt;a href="https://www.ibm.com/cloud/blog/ibm-cloud-continuous-delivery-tekton-pipelines-tools-and-resources" rel="noopener noreferrer"&gt;https://www.ibm.com/cloud/blog/ibm-cloud-continuous-delivery-tekton-pipelines-tools-and-resources&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tanzu&lt;/strong&gt;: &lt;a href="https://tanzu.vmware.com/developer/guides/ci-cd/tekton-what-is/" rel="noopener noreferrer"&gt;https://tanzu.vmware.com/developer/guides/ci-cd/tekton-what-is/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Jenkins X&lt;/strong&gt;: pipelines based on Tekton  (&lt;a href="https://jenkins-x.io/es/docs/concepts/jenkins-x-pipelines" rel="noopener noreferrer"&gt;https://jenkins-x.io/es/docs/concepts/jenkins-x-pipelines&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And, talking about &lt;strong&gt;Argo CD&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Red Hat&lt;/strong&gt;: &lt;a href="https://developers.redhat.com/blog/2020/08/17/openshift-joins-the-argo-cd-community-kubecon-europe-2020/" rel="noopener noreferrer"&gt;https://developers.redhat.com/blog/2020/08/17/openshift-joins-the-argo-cd-community-kubecon-europe-2020/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IBM&lt;/strong&gt;: &lt;a href="https://www.ibm.com/cloud/blog/simplify-and-automate-deployments-using-gitops-with-ibm-multicloud-manager-3-1-2" rel="noopener noreferrer"&gt;https://www.ibm.com/cloud/blog/simplify-and-automate-deployments-using-gitops-with-ibm-multicloud-manager-3-1-2&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  ¿CI/CD Cloud Native?
&lt;/h2&gt;

&lt;p&gt;We're talking a lot about "cloud native" associated to Tekton y Argo CD but, what do we mean by that? As I said before, both Tekton and Argo CD are installed in the Kubernetes cluster and they are based on extending Kubernetes API. Let's see it in detail:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;: both tools are installed in the cluster and because of that, they work creating pods to perform tasks. Pods are the way in which applications can scale horizontally...so, scalabilly are guaranteed&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Portabillity&lt;/strong&gt;: both tools are based on extending Kubernetes API, creating new Kubernetes objects. These objects can be installed in every Kubernetes cluster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reusability&lt;/strong&gt;: the different elements within the CI/CD process use the Kubernetes objects defined by Tekton and Argo CD in the same way that you work with deployments o service objects. That means that stages, tasks or applications are YAML files that you can store in some repository and use in every cluster with Tekton and Argo CD installed. For instance, it's possible to use artifacts from &lt;a href="https://dev.tohub/cat%C3%A1logo%20asociado%20directamente%20al%20proyecto%20Tekton"&gt;Tekton catalog&lt;/a&gt; or even, it's possible to use the &lt;a href="https://github.com/openshift/pipelines-catalog" rel="noopener noreferrer"&gt;Openshift catalog&lt;/a&gt; or building a custom one. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  What are we going to build?
&lt;/h2&gt;

&lt;p&gt;We are going to build a simple CI/CD process, on Kubernetes, with these stages:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fpipeline-stages.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fpipeline-stages.png" alt="pipeline-stages"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;In this pipeline, we can see two different parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;CI part&lt;/strong&gt;, implemented by Tekton and ending with a stage in which a push to a repository is done.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Checkout&lt;/em&gt;: in this stage, source code repository is cloned&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Build &amp;amp; Test&lt;/em&gt;: in this stage, we use Maven to build and execute test&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Code Analisys:&lt;/em&gt; code is evaluated by Sonarqube&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Publish&lt;/em&gt;: if everything is ok, artifact is published to Nexus&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Build image&lt;/em&gt;: in this stage, we build the image and publish to local registry&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Push to GitOps repo&lt;/em&gt;: this is the final CI stage, in which Kubernetes descriptors are cloned from the GitOps repository, they are modified in order to insert commit info and then, a push action is performed to upload changes to GitOps repository&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CD part&lt;/strong&gt;, implemented by Argo CD, in which Argo CD detects that the repository has changed and perform the sync action against the Kubernetes cluster.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Does it mean that we can not implement the whole process using Tekton?&lt;/strong&gt; No, it doesn't. It's possible to implement the whole process using Tekton but in this case, I want to show the &lt;strong&gt;Gitops concept&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  Hands-on!
&lt;/h2&gt;


&lt;h3&gt;
  
  
  Requirements
&lt;/h3&gt;

&lt;p&gt;To execute this PoC it's you need to have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Kubernetes cluster. If you don't have one, you can create a K3D one using the script &lt;strong&gt;create-local-cluster.sh&lt;/strong&gt; but, obviously, you need to have installed &lt;a href="https://k3d.io/" rel="noopener noreferrer"&gt;K3D&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;Kubectl&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  Repository structure
&lt;/h3&gt;

&lt;p&gt;I've used a single repo to manage the different projects. The repository is structured in this way:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Frepo_org.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Frepo_org.png" alt="repo_org"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;poc&lt;/strong&gt;: this is the main folder. Here, you can find three scripts:

&lt;ul&gt;
&lt;li&gt;create-local-cluster.sh: this script creates a local Kubernetes cluster based on &lt;a href="https://k3d.io/" rel="noopener noreferrer"&gt;K3D&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;delete-local-cluster.sh: this script removes the local cluster&lt;/li&gt;
&lt;li&gt;setup-poc.sh: this script installs and configure everything neccessary in the cluster (Tekton, Argo CD, Nexus, Sonar, etc...)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;resources&lt;/strong&gt;: this the folder used to manage the two repositories (code and gitops):

&lt;ul&gt;
&lt;li&gt;sources-repo: source code of the service used in this poc to test the CI/CD process&lt;/li&gt;
&lt;li&gt;gitops_repo: repository where Kubernetes files associated to the service to be deployed are&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  Ok, how can I execute it?
&lt;/h3&gt;


&lt;h4&gt;
  
  
  1) Fork
&lt;/h4&gt;

&lt;p&gt;The first step is to fork the repo &lt;a href="https://github.com/jaruizes/tekton-argocd-poc" rel="noopener noreferrer"&gt;https://github.com/jaruizes/tekton-argocd-poc&lt;/a&gt; because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have to modify some files to add a token&lt;/li&gt;
&lt;li&gt;You need your own repo to perform Gitops operations&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  2) Add Github token
&lt;/h3&gt;

&lt;p&gt;It's necessary to add a Github Personal Access Token to Tekton can perform git operations, like push to gitops repo. If you need help to create this token, you can follow these instructions: &lt;a href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token" rel="noopener noreferrer"&gt;https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;** The token needs to be allowed with "repo" grants.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once the token is created, you have to copy it in these files (## INSERT TOKEN HERE:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;poc/conf/argocd/git-repository.yaml&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  apiVersion: v1
  kind: Secret
  metadata:
    annotations:
      managed-by: argocd.argoproj.io
    name: repo-gitops
    namespace: argocd
  type: Opaque
  stringData:
    username: tekton
    password: ## INSERT TOKEN HERE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;poc/conf/tekton/git-access/secret.yaml&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  apiVersion: v1
  kind: Secret
  metadata:
    name: git-auth
    namespace: tekton-poc
    annotations:
      tekton.dev/git-0: https://github.com
  type: kubernetes.io/basic-auth
  stringData:
    username: tekton
    password: ## INSERT TOKEN HERE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;blockquote&gt;
&lt;p&gt;** In fact, for Argo CD, create secret with the token isn't necessary because the gitops repository in Github has public access but I think it's interesting to keep it in order to know what you need to do in case the repository be private.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h3&gt;
  
  
  3) Create Kubernetes cluster (optional)
&lt;/h3&gt;

&lt;p&gt;This step is optional. If you already have a cluster, perfect, but if not, you can create a local one based on K3D, just executing the script &lt;strong&gt;poc/create-local-cluster.sh&lt;/strong&gt;. This script creates the local cluster and configure the private image registry to manage Docker images.&lt;/p&gt;


&lt;h3&gt;
  
  
  4) Setup
&lt;/h3&gt;

&lt;p&gt;This step is the most important because installs and configures everything necessary in the cluster:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installs Tekton y Argo CD, including secrets to access to Git repo&lt;/li&gt;
&lt;li&gt;Creates the volume and claim necessary to execute pipelines&lt;/li&gt;
&lt;li&gt;Deploys Tekton dashboard&lt;/li&gt;
&lt;li&gt;Deploys Sonarqube&lt;/li&gt;
&lt;li&gt;Deploys Nexus and configure an standard instance&lt;/li&gt;
&lt;li&gt;Creates the configmap associated to Maven settings.xml, ready to publish artifacts in Nexus (with user and password)&lt;/li&gt;
&lt;li&gt;Installs Tekton tasks and pipelines

&lt;ul&gt;
&lt;li&gt;Git-clone (from Tekton Hub)&lt;/li&gt;
&lt;li&gt;Maven (from Tekton Hub)&lt;/li&gt;
&lt;li&gt;Buildah (from Tekton Hub)&lt;/li&gt;
&lt;li&gt;Prepare Image (custom task: poc/conf/tekton/tasks/prepare-image-task.yaml)&lt;/li&gt;
&lt;li&gt;Push to GitOps repo (custom task: poc/conf/tekton/tasks/push-to-gitops-repo.yaml)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Installs Argo CD application, configured to check changes in gitops repository (resources/gitops_repo)&lt;/li&gt;
&lt;li&gt;Update Argo CD password&lt;/li&gt;
&lt;/ul&gt;



&lt;blockquote&gt;
&lt;p&gt;** &lt;strong&gt;Be patient&lt;/strong&gt;. The process takes some minutes.&lt;/p&gt;

&lt;p&gt;** &lt;strong&gt;This message isn't an error&lt;/strong&gt;. It just waiting for to Nexus admin password created when the container starts. When the Nexus container starts, at some moment, it creates a file containing the default password.&lt;/p&gt;


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Configuring settings.xml (MAVEN) to work with Nexus
cat: /nexus-data/admin.password: No such file or directory
command terminated with exit code 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;


&lt;h3&gt;
  
  
  5) Explore and play
&lt;/h3&gt;

&lt;p&gt;Once everything is installed, you can play with this project:&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Tekton Part&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Tekton dashboard could be exposed locally using this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl proxy &lt;span class="nt"&gt;--port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
Then, just open this url in the browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://localhost:8080/api/v1/namespaces/tekton-pipelines/services/tekton-dashboard:http/proxy/#/namespaces/cicd/pipelineruns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;By that link you'll access to &lt;strong&gt;PipelineRuns options&lt;/strong&gt; and you'll see a pipeline executing:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fpipeline_running.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fpipeline_running.png" alt="pipeline_running"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to &lt;strong&gt;check what Tasks are installed in the cluster&lt;/strong&gt;, you can navigate to Tasks option:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Finstalled_tasks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Finstalled_tasks.png" alt="installed_tasks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you click in this pipelinerun you'll see the different executed &lt;strong&gt;stages&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fpipelinerun-stages.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fpipelinerun-stages.png" alt="pipelinerun-stages"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Each stage is executed by a pod&lt;/strong&gt;. For instance, you can execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; kubectl get pods &lt;span class="nt"&gt;-n&lt;/span&gt; cicd &lt;span class="nt"&gt;-l&lt;/span&gt; &lt;span class="s2"&gt;"tekton.dev/pipelineRun=products-ci-pipelinerun"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to see how different pods are created to execute different stages:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fstages-pod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fstages-pod.png" alt="pipelinerun-stages-pods"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;It's possible to &lt;strong&gt;access to Sonarqube&lt;/strong&gt; to check quality issues, opening this &lt;a href="http://localhost:9000/projects" rel="noopener noreferrer"&gt;url&lt;/a&gt; in the browser:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fsonarqube.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fsonarqube.png" alt="sonarqube"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;** In this pipeline, it doesn't check if quality gate is passed.&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p&gt;And It's also possible to &lt;strong&gt;access to Nexus&lt;/strong&gt; to check how the artifact has been published:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fnexus.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fnexus.png" alt="nexus"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I said before, the last stage in CI part consist on &lt;strong&gt;performing a push action to GitOps repository&lt;/strong&gt;. In this stage, content from GitOps repo is cloned, commit information is updated in cloned files (Kubernentes descriptors) and a push is done. The following picture shows an example of this changes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fcommit-changes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fcommit-changes.png" alt="commit changes"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Argo CD Part&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To access to &lt;strong&gt;Argo CD dashboard&lt;/strong&gt; you need to perform a port-forward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl port-forward svc/argocd-server &lt;span class="nt"&gt;-n&lt;/span&gt; argocd 9080:443
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
Then, just open this url in the browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;https://localhost:9080/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I've set the admin user with these credentials: admin / admin123&lt;/p&gt;

&lt;p&gt;In this dashboard you should be the "product service" application that manages synchronization between Kubernetes cluster and GitOps repository&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fargocd_initial.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fargocd_initial.png" alt="argocd_initial"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;This application is "healthy" but as the objects associated with Product Service (Pods, Services, Deployment,...etc) aren't still deployed to&lt;br&gt;
the Kubernetes cluster, you'll find a "unknown" sync status. &lt;/p&gt;

&lt;p&gt;Once the "pipelinerun" ends and changes are pushed to GitOps repository, Argo CD compares content deployed in the Kubernetes cluster (associated to Products Service) with content pushed to the GitOps repository and synchronize Kubernetes cluster against the repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fargocd-products.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fargocd-products.png" alt="argocd-products"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, the sync status become "Synced":&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fargocd_final.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fjaruiz.io%2Fimages%2Ftekton-argocd%2Fargocd_final.png" alt="argocd_initial"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h3&gt;
  
  
  6) Delete the local cluster (optional )
&lt;/h3&gt;

&lt;p&gt;If you create a local cluster in step 3, there is an script to remove the local cluster. This script is &lt;strong&gt;poc/delete-local-cluster.sh&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
I hope you’ve liked this post. In next posts we'll cover &lt;strong&gt;Tekton triggers&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>cloudnative</category>
      <category>cicd</category>
    </item>
  </channel>
</rss>
