本文主要是介绍生成tekton dashboard,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
我们在之前的(安装和构建ci)实践中,用到都是tekton cli,查看ci执行情况都是通过logs,不是很友好。 tekton dashboard提供了很多的ui界面。这里我们来安装并使用。
1. 创建dashboard.yaml
apiVersion: v1
kind: Namespace
metadata:labels:app.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardname: tekton-dashboard
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:labels:app.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardname: extensions.dashboard.tekton.dev
spec:group: dashboard.tekton.devnames:categories:- tekton- tekton-dashboardkind: Extensionplural: extensionsshortNames:- ext- extspreserveUnknownFields: falsescope: Namespacedversions:- additionalPrinterColumns:- jsonPath: .spec.apiVersionname: API versiontype: string- jsonPath: .spec.namename: Kindtype: string- jsonPath: .spec.displaynamename: Display nametype: string- jsonPath: .metadata.creationTimestampname: Agetype: datename: v1alpha1schema:openAPIV3Schema:type: objectx-kubernetes-preserve-unknown-fields: trueserved: truestorage: truesubresources:status: {}
---
apiVersion: v1
kind: ServiceAccount
metadata:labels:app.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardname: tekton-dashboardnamespace: tekton-pipelines
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:labels:app.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardname: tekton-dashboard-infonamespace: tekton-pipelines
rules:- apiGroups:- ""resourceNames:- dashboard-inforesources:- configmapsverbs:- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:labels:app.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardname: tekton-dashboard-backend
rules:- apiGroups:- apiextensions.k8s.ioresources:- customresourcedefinitionsverbs:- get- list- apiGroups:- security.openshift.ioresources:- securitycontextconstraintsverbs:- use- apiGroups:- tekton.devresources:- clustertasksverbs:- get- list- watch- apiGroups:- triggers.tekton.devresources:- clusterinterceptors- clustertriggerbindingsverbs:- get- list- watch- apiGroups:- ""resources:- serviceaccountsverbs:- get- list- watch- apiGroups:- dashboard.tekton.devresources:- extensionsverbs:- create- update- delete- patch- apiGroups:- tekton.devresources:- clustertasksverbs:- create- update- delete- patch- apiGroups:- triggers.tekton.devresources:- clusterinterceptors- clustertriggerbindingsverbs:- create- update- delete- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:labels:app.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardname: tekton-dashboard-tenant
rules:- apiGroups:- dashboard.tekton.devresources:- extensionsverbs:- get- list- watch- apiGroups:- ""resources:- events- namespaces- pods- pods/logverbs:- get- list- watch- apiGroups:- tekton.devresources:- tasks- taskruns- pipelines- pipelineruns- customrunsverbs:- get- list- watch- apiGroups:- triggers.tekton.devresources:- eventlisteners- interceptors- triggerbindings- triggers- triggertemplatesverbs:- get- list- watch- apiGroups:- tekton.devresources:- tasks- taskruns- pipelines- pipelineruns- customrunsverbs:- create- update- delete- patch- apiGroups:- triggers.tekton.devresources:- eventlisteners- interceptors- triggerbindings- triggers- triggertemplatesverbs:- create- update- delete- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:labels:app.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardname: tekton-dashboard-infonamespace: tekton-pipelines
roleRef:apiGroup: rbac.authorization.k8s.iokind: Rolename: tekton-dashboard-info
subjects:- apiGroup: rbac.authorization.k8s.iokind: Groupname: system:authenticated
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:labels:app.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardrbac.dashboard.tekton.dev/subject: tekton-dashboardname: tekton-dashboard-backend
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: tekton-dashboard-backend
subjects:- kind: ServiceAccountname: tekton-dashboardnamespace: tekton-pipelines
---
apiVersion: v1
data:version: v0.42.0
kind: ConfigMap
metadata:labels:app.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardname: dashboard-infonamespace: tekton-pipelines
---
apiVersion: v1
kind: Service
metadata:labels:app: tekton-dashboardapp.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/name: dashboardapp.kubernetes.io/part-of: tekton-dashboardapp.kubernetes.io/version: v0.42.0dashboard.tekton.dev/release: v0.42.0version: v0.42.0name: tekton-dashboardnamespace: tekton-pipelines
spec:ports:- name: httpport: 9097protocol: TCPtargetPort: 9097selector:app.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/name: dashboardapp.kubernetes.io/part-of: tekton-dashboardtype: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:labels:app: tekton-dashboardapp.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/name: dashboardapp.kubernetes.io/part-of: tekton-dashboardapp.kubernetes.io/version: v0.42.0dashboard.tekton.dev/release: v0.42.0version: v0.42.0name: tekton-dashboardnamespace: tekton-pipelines
spec:replicas: 1selector:matchLabels:app.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/name: dashboardapp.kubernetes.io/part-of: tekton-dashboardtemplate:metadata:labels:app: tekton-dashboardapp.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/name: dashboardapp.kubernetes.io/part-of: tekton-dashboardapp.kubernetes.io/version: v0.42.0name: tekton-dashboardspec:containers:- args:- --port=9097- --logout-url=- --pipelines-namespace=tekton-pipelines- --triggers-namespace=tekton-pipelines- --read-only=false- --log-level=info- --log-format=json- --namespace=- --namespaces=- --stream-logs=true- --external-logs=env:- name: INSTALLED_NAMESPACEvalueFrom:fieldRef:fieldPath: metadata.namespaceimage: registry.cn-hangzhou.aliyuncs.com/acs-demo-ns/tekton-dashboard:v0.42.0livenessProbe:httpGet:path: /healthport: 9097name: tekton-dashboardports:- containerPort: 9097readinessProbe:httpGet:path: /readinessport: 9097securityContext:allowPrivilegeEscalation: falsecapabilities:drop:- ALLrunAsGroup: 65532runAsNonRoot: truerunAsUser: 65532seccompProfile:type: RuntimeDefaultserviceAccountName: tekton-dashboardvolumes: []---
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:labels:app.kubernetes.io/component: dashboardapp.kubernetes.io/instance: defaultapp.kubernetes.io/part-of: tekton-dashboardrbac.dashboard.tekton.dev/subject: tekton-dashboardname: tekton-dashboard-tenant
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: tekton-dashboard-tenant
subjects:- kind: ServiceAccountname: tekton-dashboardnamespace: tekton-pipelines
2. 安装dashboard
kubectl apply -f dashboard.yaml
3. 查看dashboard
kubectl get deploy -n tekton-pipelines | grep dashboard
kubectl get svc -n tekton-pipelines | grep dashboard
我的输出为:
carawang@ci %kubectl get svc -n tekton-pipelines | grep dashboard
tekton-dashboard LoadBalancer 10.103.207.156 <pending> 9097:30755/TCP 4m52s
因为我用的是minikube,没有endpoint可以供访问,需要forward一下。
4. forward dashboard
kubectl port-forward -n tekton-pipelines service/tekton-dashboard 9097:9097
不报错的话,就可以访问http://localhost:9097
5. 查看pipelineruns等
可以看到界面很友好。
这篇关于生成tekton dashboard的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!