

Deploying Applications to IBM Cloud Kubernetes via Tekton
source link: https://www.tuicool.com/articles/qiiMbeV
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

This article describes Tekton, an open-source framework for creating CI/CD systems, and explains how to deploy and use it on the IBM Cloud Kubernetes service.
What is Tekton?
Kubernetes is the de-facto standard for running cloud-native applications. While Kubernetes is very flexible and powerful, deploying applications is sometimes challenging for developers. That’s why several platforms and tools have evolved that aim to make deployments of applications easier, for example Cloud Foundry’s ‘cf push’ experience, OpenShift’s source to image (S2I), various Maven plugins and different CI/CD systems.
Similarly as Kubernetes has evolved to be the standard for running containers and similarly as Knative is evolving to become the standard for serverless platforms, the goal of Tekton is to become the standard for continuous integration and delivery (CI/CD) platforms.
Here is the definition from the project’s home page :
Tekton is a powerful yet flexible Kubernetes-native open-source framework for creating CI/CD systems. It lets you build, test, and deploy across multiple cloud providers or on-premises systems by abstracting away the underlying implementation details.
As described in this intro video , Tekton is a shared set of open source building blocks that are composable, declarative and reproducible CI/CD systems.
The biggest companies that are engaged in this project are at this point Google, CloudBees, IBM and Red Hat. Because of its importance the project has been split from Knative which is focussed on scale to zero capabilities.
Deploying a Sample Application to IBM Cloud Kubernetes
The first thing you should get familiar with to use Tekton is its terminology and component model. Check out the documentation to understand what tasks, steps, pipelines, etc. are.
My colleague Gregory Dritschler has written a tutorial Deploy a Knative application using Tekton Pipelines . The same principles apply also for other (non Knative) containers.
I don’t want to repeat Gregory’s tutorial here, but outline some points that took me some time to understand. Here are the steps to deploy a simple hello world sample on the IBM Cloud Kubernetes service.
First get an IBM lite account . It’s free and there is no time restriction. In order to use the Kubernetes service you need to enter your credit card information, but there is a free Kubernetes cluster.
Next you need to install some prerequisites as described in the tutorial. Note that in order to run the tutorial with a lite account, you need to install Knative manually since the Knative add on currently doesn’t work.
Then run these commands to login and create two tasks, one pipeline and a resource pointing to your source:
$ ibmcloud login -a cloud.ibm.com -r us-south -g default $ ibmcloud ks cluster-config --cluster niklas-heidloff-4 $ export <output-from-previous-command> $ git clone https://github.com/IBM/tekton-tutorial $ cd tekton-tutorial $ kubectl apply -f tekton/tasks/source-to-image.yaml $ kubectl apply -f tekton/tasks/deploy-using-kubectl.yaml $ kubectl apply -f tekton/pipeline/build-and-deploy-pipeline.yaml $ kubectl apply -f tekton/resources/picalc-git.yaml
Next a secret and a pipeline account needs to be created to access your image registry on the IBM Cloud from Tekton:
$ ibmcloud iam api-key-create tekton -d "tekton" --file tekton.json $ cat tekton.json | grep apikey $ kubectl create secret generic ibm-cr-push-secret --type="kubernetes.io/basic-auth" --from-literal=username=iamapikey --from-literal=password=<your-apikey> $ kubectl annotate secret ibm-cr-push-secret tekton.dev/docker-0=us.icr.io $ kubectl apply -f tekton/pipeline-account.yaml
Before the pipeline can be run, your registry’s DNS name and your namespace need to be defined in ‘tekton/run/picalc-pipeline-run.yaml’. Here is how you find this information:
$ ibmcloud cr region $ ibmcloud cr namespace-list
After you’ve defined this information in ‘picalc-pipeline-run.yaml’, the pipeline can be run:
$ kubectl create -f tekton/run/picalc-pipeline-run.yaml $ kubectl describe pipelinerun picalc-pr-<output-from-previous-command> $ kubectl get ksvc picalc $ curl http://picalc-default.<...>.us-south.containers.appdomain.cloud?iterations=20000000
Using the Tekton Dashboard
In addition to Tekton Pipelines there is another project Tekton Dashboard to visualize the definitions and output of pipelines.
In order to run it on the IBM Cloud, clone the repo:
$ git clone https://github.com/tektoncd/dashboard.git $ cd dashboard
Before you can install it, one file needs to be changed. Since the lite account doesn’t provide Ingress capabilities, you need to define to use NodePort for the dashboard service.
In order to do this, add “type: NodePort” in line 145 in ‘config/release/gcr-tekton-dashboard.yaml’:
kind: Service apiVersion: v1 metadata: name: tekton-dashboard namespace: tekton-pipelines labels: app: tekton-dashboard spec: ports: - name: http protocol: TCP port: 9097 targetPort: 9097 type: NodePort selector: app: tekton-dashboard
After this run these commands to install and open the dashboard:
$ kubectl apply -f config/release/gcr-tekton-dashboard.yaml $ CLUSTER_NAME=<your-cluster-name> $ clusterip=$(ibmcloud ks workers --cluster $CLUSTER_NAME | awk '/Ready/ {print $2;exit;}') $ nodeport=$(kubectl get svc tekton-dashboard -n tekton-pipelines --ignore-not-found --output 'jsonpath={.spec.ports[*].nodePort}') $ open http://$clusterip:$nodeport
This screenshot shows the results of the pipeline runs:
This screenshot shows the results of the task runs:
Recommend
-
85
Deploying Java Applications with Docker and Kubernetes Get started orchestrating containerized applications at scale.
-
47
README.md KubeDirector The BlueK8s open source initiative will include a number of projects t...
-
43
概况 Tekton 是一个功能强大且灵活的 Kubernetes 原生开源框架,用于创建持续集成和交付(CI/CD)系统。通过抽象底层实现细节,用户可以跨多云平台和本地系统进行构建、测试和部署。
-
38
This article describes Tekton , an open-source framework for creating CI/CD systems, and explains how to deploy microservices built with E...
-
43
如果有关注过Knative社区动态的同学,可能会知道最近发生了一件比较大的新闻,三大组件之一的build项目被人提了一个很残忍的 Proposal ,并且专门在项目Readme的开头加了个NO...
-
13
Hello HelmOps with Tekton and Chartmuseum on Kubernetes
-
14
Deploying CodeReady Workspaces on the IBM Cloud This short article describes how to deploy CodeReady Workspaces on OpenShift on IBM Cloud. The deployment is pretty straight forward with one exception which is...
-
11
Adopting Tekton — Cloud Native CI Solutionhttps://tekton.dev/We have been exploring Tekton as a CI platform recently for office and off-office work. So I thought to share all my...
-
14
Deploying Tekton on OpenShift This article explains how to install Tekton on OpenShift and how to run pipelines of a cloud native sample application. Tekton is an open source...
-
4
Deploying Kubernetes Resources via GitOps Infrastructure as Code is an important concept of DevOps. With GitOps tools like
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK