update devops doc

Signed-off-by: zhuxiujuan28 <562873187@qq.com>
This commit is contained in:
zhuxiujuan28 2024-10-17 13:26:23 +08:00
parent 066ec6b18c
commit b6062aaf63
9 changed files with 167 additions and 86 deletions

View File

@ -298,12 +298,12 @@ weight: 01
// |ServiceMesh
// |1.0.x
// |1.22~1.25
// |1.22~1.28
// |amd64、arm64
// |KubeEdge
// |1.13.1
// |1.21-1.23
// |1.21-1.28
// |amd64、arm64
// |RadonDB DMP

View File

@ -1,7 +1,7 @@
---
title: "删除 DevOps 项目"
keywords: "Kuberentes, {ks_product}, 企业空间管理, DevOps 项目, 删除 DevOps 项目"
description: "介绍如何编辑删除 DevOps 项目。"
description: "介绍如何删除 DevOps 项目。"
weight: 04
---

View File

@ -82,7 +82,7 @@ DevOps 中的图形编辑面板包含用于 Jenkins link:https://www.jenkins.io/
|===
--
. 再为 SonarQube 创建一个凭证 (**sonar-token**),用于上述的阶段 3代码分析。凭证类型选择**访问令牌**,在**令牌**字段输入 SonarQube 令牌请参阅link:../../../04-how-to-integrate/01-sonarqube/[为新项目创建 SonarQube 令牌 (Token)]。点击**确定**完成操作。
. 再为 SonarQube 创建一个凭证 (**sonar-token**),用于上述的阶段 3代码分析。凭证类型选择**访问令牌**,在**令牌**字段输入 SonarQube 令牌请参阅link:../../../04-how-to-integrate/01-sonarqube/#_为新项目创建_sonarqube_token[为新项目创建 SonarQube Token]。点击**确定**完成操作。
. 创建完成后,您将在凭证页面看到已创建的凭证。
@ -274,7 +274,7 @@ image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-gr
+
image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/timeout_set.png[,100%]
. 点击**超时**步骤下的**添加嵌套步骤**,选择**代码质量检查 (SonarQube)**。在弹出的对话框中选择**检查通过后开始后续任务**。点击**确定**保存操作。
. 点击**超时**步骤下的**添加嵌套步骤**,选择**代码质量检查 (SonarQube)**。在弹出的对话框中勾选**如果质量阈值状态不是绿色,则中止流水线**。点击**确定**保存操作。
+
image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/waitforqualitygate_set.png[,100%]
+

View File

@ -0,0 +1,88 @@
---
title: "登录 Jenkins 仪表板"
keywords: "Kubernetes, {ks_product}, DevOps 项目, 使用 DevOps, 访问 Jenkins"
description: "介绍如何登录 Jenkins 仪表板。"
weight: 07
---
安装 DevOps 时,默认情况下也会安装 Jenkins 仪表板。但需按照以下步骤配置后,才能访问 Jenkins 仪表板。
== 前提条件
{ks_product_right}平台需要安装并启用 **DevOps** 扩展组件。
== 操作步骤
. 在集群节点上执行以下命令获取 Jenkins 的地址。
+
--
// Bash
[,bash]
----
export NODE_PORT=$(kubectl get --namespace kubesphere-devops-system -o jsonpath="{.spec.ports[0].nodePort}" services devops-jenkins)
export NODE_IP=$(kubectl get nodes --namespace kubesphere-devops-system -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
----
您将获得如下输出:
[,bash]
----
http://10.77.1.201:30180
----
--
. 检查 DevOps 扩展组件配置中的 `jenkins.securityRealm.openIdConnect.kubesphereCoreApi` 和 `jenkins.securityRealm.openIdConnect.jenkinsURL` ,确保已经分别修改为 kubesphere-console 和 devops-jenkins 服务实际可访问的地址。如果不是,请修改并等待组件更新完成。
+
[,yaml]
----
jenkins:
securityRealm:
openIdConnect:
# The kubesphere-core api used for jenkins OIDC
# If you want to access to jenkinsWebUI, the kubesphereCoreApi must be specified and browser-accessible
# Modifying this configuration will take effect only during installation
# If you wish for changes to take effect after installation, you need to update the jenkins-casc-config ConfigMap, copy the securityRealm configuration from jenkins.yaml to jenkins_user.yaml, save, and wait for approximately 70 seconds for the changes to take effect.
kubesphereCoreApi: "http://192.168.1.1:30880"
# The jenkins web URL used for OIDC redirect
jenkinsURL: "http://192.168.1.1:30180"
----
. 检查配置字典 `jenkins-casc-config` 中 `jenkins_user.yaml` 下 `securityRealm.oic` 的所有地址,确保与 `jenkins.yaml` 下 `securityRealm.oic` 中的一样,都改为 kubesphere-console 实际可访问的地址。如果不一样,请修改并等待其生效。
+
[,yaml]
----
securityRealm:
oic:
clientId: "jenkins"
clientSecret: "jenkins"
tokenServerUrl: "http://192.168.1.1:30880/oauth/token"
authorizationServerUrl: "http://192.168.1.1:30880/oauth/authorize"
userInfoServerUrl: "http://192.168.1.1:30880/oauth/userinfo"
endSessionEndpoint: "http://192.168.1.1:30880/oauth/logout"
logoutFromOpenidProvider: true
scopes: openid profile email
fullNameFieldName: url
userNameField: preferred_username
----
. 检查配置字典 `kubesphere-config` 中的 `authentication.issuer.url`,确保已经修改为 kubesphere-console 实际可访问的地址。如果不是,请修改并重启 Deployment ks-apiserver 使其生效。
+
--
[,yaml]
----
authentication:
issuer:
url: "http://192.168.1.1:30880"
----
[source,bash]
----
kubectl -n kubesphere-system rollout restart deploy ks-apiserver
----
--
. 使用地址 http://NodeIP:30180 访问 Jenkins 仪表板。
+
Jenkins 配置有{ks_product_left} LDAP这意味着您可以直接使用{ks_product_both}账户(例如 `admin/P@88w0rd`)登录 Jenkins。

View File

@ -21,9 +21,9 @@ weight: 08
* 已有一个可用 Jenkins 共享库。本教程以 link:https://github.com/devops-ws/jenkins-shared-library[GitHub 仓库]中的 Jenkins 共享库为例。
== 步骤 1在 Jenkins 仪表配置共享库
== 步骤 1在 Jenkins 仪表配置共享库
. link:../../../04-how-to-integrate/01-sonarqube/[登录 Jenkins 仪表板]并点击左侧导航栏中的**系统管理**。
. link:../07-access-jenkins-console[登录 Jenkins 仪表板]并点击左侧导航栏中的**系统管理**。
. 向下滚动并点击**系统配置**。

View File

@ -6,9 +6,9 @@ weight: 01
---
link:https://www.sonarqube.org/[SonarQube] 是一种主流的代码质量持续检测工具可用于代码库的静态和动态分析。SonarQube 集成到{ks_product_both}流水线后,如果在运行的流水线中检测到问题,将会在仪表板上直接显示常见代码问题。
link:https://www.sonarqube.org/[SonarQube] 是一种主流的代码质量持续检测工具可用于代码库的静态和动态分析。SonarQube 集成到{ks_product_both}流水线后,如果在运行的流水线中检测到问题,将会在仪表板上直接显示常见代码问题,例如 Bug 和漏洞
本文档演示如何将 SonarQube 集成到流水线中。在link:../../03-how-to-use/02-pipelines/02-create-a-pipeline-using-jenkinsfile/[使用 Jenkinsfile 创建流水线]之前,请先阅读本节内容
本文档演示如何将 SonarQube 集成到流水线中。在link:../../03-how-to-use/02-pipelines/02-create-a-pipeline-using-jenkinsfile/[使用 Jenkinsfile 创建流水线]之前,请先参考以下步骤
== 前提条件
@ -18,7 +18,7 @@ link:https://www.sonarqube.org/[SonarQube] 是一种主流的代码质量持续
== 安装 SonarQube 服务器
要将 SonarQube 集成到您的流水线,必须先安装 SonarQube 服务器。
要将 SonarQube 集成到您的流水线,必须先在集群节点上安装 SonarQube 服务器。
. 安装 Helm以便使用该工具安装 SonarQube。例如运行以下命令安装 Helm 3
+
@ -26,7 +26,7 @@ link:https://www.sonarqube.org/[SonarQube] 是一种主流的代码质量持续
// Bash
[,bash]
----
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3|bash
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
----
查看 Helm 版本。
@ -82,9 +82,7 @@ kubesphere-devops-system --create-namespace --set service.type=NodePort
[,bash]
----
export NODE_PORT=$(kubectl get --namespace kubesphere-devops-system -o jsonpath="{.spec.ports[0].nodePort}" services sonarqube-sonarqube)
export NODE_IP=$(kubectl get nodes --namespace kubesphere-devops-system -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
----
--
@ -110,7 +108,12 @@ http://10.77.1.201:31377
// Bash
[,bash]
----
kubectl get pod -n kubesphere-devops-system
$ kubectl get pod -n kubesphere-devops-system
NAME READY STATUS RESTARTS AGE
devops-jenkins-68b8949bb-7zwg4 1/1 Running 0 84m
s2ioperator-0 1/1 Running 1 84m
sonarqube-postgresql-0 1/1 Running 0 5m31s
sonarqube-sonarqube-bb595d88b-97594 1/1 Running 2 5m31s
----
--
@ -133,12 +136,18 @@ kubectl get pod -n kubesphere-devops-system
=== 步骤 2创建 SonarQube 管理员令牌 (Token)
. 点击右上角字母 **A**,然后从菜单中选择 **My Account** 以转到 **Profile** 页面。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-config-1.png[]
. 点击 **Security** 并输入令牌名称,例如 **kubesphere**。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-config-2.png[]
. 点击 **Generate** 并复制此令牌。
+
--
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-config-3.png[]
//note
[.admon.note,cols="a"]
|===
@ -155,15 +164,11 @@ kubectl get pod -n kubesphere-devops-system
+
--
// Bash
[,bash]
[source,bash]
----
export NODE_PORT=$(kubectl get --namespace kubesphere-devops-system -o jsonpath="{.spec.ports[0].nodePort}" services devops-jenkins)
export NODE_IP=$(kubectl get nodes --namespace kubesphere-devops-system -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT/sonarqube-webhook/
----
--
@ -173,55 +178,24 @@ echo http://$NODE_IP:$NODE_PORT/sonarqube-webhook/
// Bash
[,bash]
----
http://10.77.1.201:30180/sonarqube-webhook/
----
--
. 依次点击 **Administration**、**Configuration** 和 **Webhooks** 创建一个 Webhook。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-webhook-1.png[]
. 点击 **Create**。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-webhook-2.png[]
. 在弹出的对话框中输入 **Name** 和 **Jenkins Console URL**(即 SonarQube Webhook 地址)。点击 **Create** 完成操作。
=== 步骤 4将 SonarQube 配置添加到 ks-installer
. 执行以下命令编辑 **ks-installer**。
+
--
// Bash
[,bash]
----
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/webhook-page-info.png[]
kubectl edit cc -n kubesphere-system ks-installer
----
--
. 搜寻至 **devops**。添加字段 **sonarqube** 并在其下方指定 **externalSonarUrl** 和 **externalSonarToken**。
+
--
[,yaml]
----
devops:
enabled: true
jenkinsJavaOpts_MaxRAM: 2g
jenkinsJavaOpts_Xms: 512m
jenkinsJavaOpts_Xmx: 512m
jenkinsMemoryLim: 2Gi
jenkinsMemoryReq: 1500Mi
jenkinsVolumeSize: 8Gi
sonarqube: # Add this field manually.
externalSonarUrl: http://10.77.1.201:31377 # The SonarQube IP address.
externalSonarToken: 00ee4c512fc987d3ec3251fdd7493193cdd3b91d # The SonarQube admin token created above.
----
--
. 完成操作后保存此文件。
=== 步骤 5将 SonarQube 服务器添加至 Jenkins
=== 步骤 4将 SonarQube 服务器添加至 Jenkins
. 执行以下命令获取 Jenkins 的地址。
+
@ -229,32 +203,25 @@ devops:
// Bash
[,bash]
----
export NODE_PORT=$(kubectl get --namespace kubesphere-devops-system -o jsonpath="{.spec.ports[0].nodePort}" services devops-jenkins)
export NODE_IP=$(kubectl get nodes --namespace kubesphere-devops-system -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
----
--
. 获取 Jenkins 的端口号。
+
--
// Bash
您将获得如下输出:
[,bash]
----
http://10.77.1.201:30180
----
--
. 参照link:../../03-how-to-use/02-pipelines/07-access-jenkins-console[登录 Jenkins 仪表板]进行配置。
. 使用地址 link:http://NodeIP:30180[] 访问 Jenkins。
+
--
安装 DevOps 时,默认情况下也会安装 Jenkins 仪表板。此外Jenkins 还配置有{ks_product_left} LDAP这意味着您可以直接使用{ks_product_both}账户登录 Jenkins。有关配置 Jenkins 的更多信息,请参阅 link:../../03-how-to-use/02-pipelines/07-jenkins-setting/[Jenkins 系统设置]。
安装 DevOps 时,默认情况下也会安装 Jenkins 仪表板。此外Jenkins 还配置有{ks_product_left} LDAP这意味着您可以直接使用{ks_product_both}账户(例如 `admin/P@88w0rd`登录 Jenkins。有关配置 Jenkins 的更多信息,请参阅 link:../../03-how-to-use/02-pipelines/07-jenkins-setting/[Jenkins 系统设置]。
//note
[.admon.note,cols="a"]
@ -273,27 +240,54 @@ http://10.77.1.201:30180
. 搜寻到 **SonarQube servers**,然后点击 **Add SonarQube**。
. 输入 **Name** 和 **Server URL** (link:http://NodeIP:NodePort[])。 点击**添加**,选择 **Jenkins**,然后在弹出的对话框中用 SonarQube 管理员令牌创建凭证(如下方第二张截图所示)。创建凭证后,从 **Server authentication token** 旁边的下拉列表中选择该凭证。点击**应用**完成操作。
. 输入 **Name** 和 **Server URL** (http://NodeIP:NodePort)。 点击**添加**,选择 **Jenkins**,然后在弹出的对话框中用 SonarQube 管理员令牌创建凭证(如下方第二张截图所示)。创建凭证后,从 **Server authentication token** 旁边的下拉列表中选择该凭证。点击**应用**完成操作。
+
--
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-jenkins-settings.png[,100%]
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/add-credentials.png[,100%]
//note
[.admon.note,cols="a"]
|===
|说明
|
如果点击**添加**按钮无效,前往**系统管理**下的 **Manage Credentials** 并点击 **Stores scoped to Jenkins** 下的 **Jenkins**,再点击**全局凭据 (unrestricted)**,然后点击左侧导航栏的**添加凭据**,参考上方第二张截图用 SonarQube 管理员令牌添加凭证。添加凭证后,从 **Server authentication token** 旁边的下拉列表中选择该凭证。
如果点击**添加**按钮无效,可前往**系统管理**下的 **Manage Credentials** 并点击 **Stores scoped to Jenkins** 下的 **Jenkins**,再点击**全局凭据 (unrestricted)**,然后点击左侧导航栏的**添加凭据**,参考下方第二张截图用 SonarQube 管理员令牌添加凭证。添加凭证后,从 **Server authentication token** 旁边的下拉列表中选择该凭证。
|===
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-jenkins-settings.png[,100%]
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/add-credentials.png[,100%]
--
=== 步骤 5将 SonarQube 配置添加到 DevOps
. 执行以下命令编辑配置字典 `devops-config`。
+
[source,bash]
----
kubectl -n kubesphere-devops-system edit cm devops-config
----
. 在 `devops` 段后添加字段 `sonarQube` 并在其下方指定 `host` 和 `token`。
+
[source,yaml]
----
devops:
host: http://devops-jenkins.kubesphere-devops-system
username: admin
maxConnections: 100
namespace: kubesphere-devops-system
workerNamespace: kubesphere-devops-worker
sonarQube:
host: http://10.77.1.201:31377
token: 00ee4c512fc987d3ec3251fdd7493193cdd3b91d
----
. 完成操作后保存此文件。
=== 步骤 6将 sonarqubeURL 添加到{ks_product_both}控制台
您需要指定 **sonarqubeURL**,以便可以直接从{ks_product_both} Web 控制台访问 SonarQube。
您需要指定 **sonarqubeURL**,以便可以直接从{ks_product_left} Web 控制台访问 SonarQube。
. 执行以下命令:
+
@ -301,9 +295,7 @@ image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-
// Bash
[,bash]
----
kubectl editcm -n kubesphere-system ks-console-config
kubectl edit cm -n kubesphere-system ks-console-config
----
--
@ -329,17 +321,13 @@ client:
// Bash
[,bash]
----
kubectl -n kubesphere-devops-system rollout restart deploy devops-apiserver
----
// Bash
[,bash]
----
kubectl -n kubesphere-system rollout restart deploy ks-console
----
@ -363,10 +351,11 @@ image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/token-created.png[,100%]
. 分别选择 **Java** 和 **Maven**复制下图所示绿色框中的序列号。如果要在流水线中使用则需要在link:../../03-how-to-use/05-devops-settings/01-credential-management/[凭证]中添加此序列号。
. 选择 **Maven**复制下图所示绿色框中的序列号。如果要在流水线中使用则需要在link:../../03-how-to-use/05-devops-settings/01-credential-management/[凭证]中添加此序列号。
+
image:/images/ks-qkcp/zh/devops-user-guide/tool-integration/integrate-sonarqube-into-pipelines/sonarqube-example.png[,100%]
== 在{ks_product_both}控制台查看结果
link:../../03-how-to-use/02-pipelines/02-create-a-pipeline-using-jenkinsfile/[使用 Jenkinsfile 创建流水线]或link:../../03-how-to-use/02-pipelines/01-create-a-pipeline-using-graphical-editing-panel/[使用图形编辑面板创建流水线]之后,即可查看代码质量分析的结果。

View File

@ -121,5 +121,5 @@ whizard-telemetry:
// |说明
// |
// 修改 WhizardTelemetry 平台服务的扩展组件配置,可配合 WhizardTelemetry 监控扩展组件,启用 Whizard 可观测中心。有关更多信息,请参阅 link:../07-whizard/01-enable-whizard/[Whizard 可观测中心]。
// 修改 WhizardTelemetry 平台服务的扩展组件配置,可配合 WhizardTelemetry 监控扩展组件,启用 Whizard 可观测中心。有关更多信息,请参阅 link:../../07-whizard/01-enable-whizard/[Whizard 可观测中心]。
// |===

View File

@ -14,7 +14,7 @@ weight: 01
* 已安装 **WhizardTelemetry 平台服务**、 **WhizardTelemetry 监控**以及 **WhizardTelemetry 告警**扩展组件。
* 已在**平台设置 > 许可证**页面导入分布式云可观测中心的 license否则无法看到 Whizard 可观测中心的入口。
// * 已在**平台设置 > 许可证**页面导入分布式云可观测中心的 license否则无法看到 Whizard 可观测中心的入口。
== 操作步骤

View File

@ -27,3 +27,7 @@ helm upgrade --install -n kubesphere-system --create-namespace ks-core https://c
- 修复部分扩展组件页面白屏的问题
- 修复 ks-core 卸载时部分资源残留的问题
- 修复 K8s 1.19 环境无法安装的问题
### 已知问题
- DevOps 中镜像构建器S2I、B2I功能在此版本暂不可用