Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to install jenkins in kubernetes

Shulou Source: shulou.com Published: 2022-06-02 05:57:30 10月02日 Update

This article shows you how to install jenkins in kubernetes. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

After installation, log in to jenkins to do the link test of kubernetes and find the following error:

Error testing connection https://kubernetes.default: Failure executing: GET at: https://kubernetes.default/api/v1/namespaces/default/pods. Message: Forbidden!Configured service account doesn't have access. Service account may have been revoked. Pods is forbidden: User "system:serviceaccount:george:default" cannot list pods in the namespace "default".

The reason is that the role of creating account binding is incorrect:

The complete brac is as follows:

# In GKE need to get RBAC permissions first with# kubectl create clusterrolebinding cluster-admin-binding-- clusterrole=cluster-admin [--user= |-- group=]-- apiVersion: v1kind: ServiceAccountmetadata: name: jenkins namespace: default---kind: RoleapiVersion: rbac.authorization.k8s.io/v1beta1metadata: name: jenkins namespace: defaultrules:- apiGroups: [""] resources: ["pods"] verbs: ["create", "delete", "get", "list", "patch", "update" "watch"]-apiGroups: [""] resources: ["pods/exec"] verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]-apiGroups: [""] resources: ["pods/log"] verbs: ["get", "list" "watch"]-apiGroups: ["] resources: [" secrets "] verbs: [" get "]-apiVersion: rbac.authorization.k8s.io/v1beta1kind: RoleBindingmetadata: name: jenkinsroleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: jenkinssubjects:- kind: ServiceAccount name: jenkins namespace: default-kind: ClusterRoleapiVersion: rbac.authorization.k8s.io/v1beta1metadata: name: jenkinsClusterRole namespace: defaultrules:- apiGroups: ["] resources: ["pods"] verbs: ["create" "delete", "get", "list", "patch", "update", "watch"]-apiGroups: [""] resources: ["pods/exec"] verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]-apiGroups: [""] resources: ["pods/log"] verbs: ["get", "list" "watch"]-apiGroups: ["] resources: [" secrets "] verbs: [" get "]-apiVersion: rbac.authorization.k8s.io/v1beta1kind: RoleBindingmetadata: name: jenkinsClusterRuleBindingroleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: jenkinsClusterRolesubjects:- kind: ServiceAccount name: jenkins namespace: default the above is how to install jenkins in kubernetes Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Content skills knowledge no concise concise reason that is articles more articles industries roles accounts information information channels links channels lights reserves Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MariaDB Xiaomi macOS Redmi