merge zh changes

Signed-off-by: zhuxiujuan28 <562873187@qq.com>
This commit is contained in:
zhuxiujuan28 2024-10-17 17:44:13 +08:00
commit e48e27f664
23 changed files with 670 additions and 109 deletions

View File

@ -57,7 +57,7 @@ This example pipeline consists of the following stages:
| Note
|
If your account or password contains any special characters such as **@** and **$**, errors may occur during pipeline runs due to unrecognized characters. In such cases, encode your account or password on a third-party website (e.g., link:https://www.urlencoder.org[urlencoder]) and then copy and paste the encoded result as your credential information.
If your account or password contains special characters such as **@** and **$**, errors may occur during pipeline runs due to unrecognized characters. In such cases, encode your account or password on a third-party website (e.g., link:https://www.urlencoder.org[urlencoder]) and then copy and paste the encoded result as your credential information.
|===
[%header,cols="1a,2a,2a"]

View File

@ -26,4 +26,9 @@ helm upgrade --install -n kubesphere-system --create-namespace ks-core https://c
- Fix white screen pages of some extensions.
- Fix problem of residual resources when uninstalling ks-core.
- Fix installation failure in K8s 1.19 environments.
- Fix installation failure in K8s 1.19 environments.
### Known issues
- The image builder (S2I, B2I) feature in DevOps is not available in this release.

View File

@ -0,0 +1,43 @@
---
title: 'Statement and Solution for KubeSphere IDOR Security Vulnerability CVE-2024-46528'
tag: 'Product News'
keywords: 'Kubernetes, KubeSphere, IDOR, Security Vulnerability'
description: 'A vulnerability of Insecure Direct Object Reference (IDOR) in KubeSphere 3.4.1 and 4.1.1.'
createTime: '2024-10-17'
author: 'KubeSphere'
image: 'https://pek3b.qingstor.com/kubesphere-community/images/kubesphere-idor-cve-en-cover.png'
---
Recently, security technicians from a third-party platform discovered a vulnerability of Insecure Direct Object Reference (IDOR) in KubeSphere 3.4.1 and 4.1.1. This vulnerability allows an authenticated attacker with low privileges to access sensitive resources without proper authorization checks. We promptly contacted the other party and helped them solve this problem. For detailed information about the CVE vulnerability and the problem-solving process, please refer to the following links:
- [CVE-2024-46528](https://nvd.nist.gov/vuln/detail/CVE-2024-46528)
- [IDOR Vulnerability in KubeSphere](https://okankurtulus.com.tr/2024/09/09/idor-vulnerability-in-kubesphere/)
## Affected Versions
- KubeSphere 4.x: < 4.1.3
- KubeSphere 3.x: >= 3.0.0, <= 3.4.1
- KubeSphere Enterprise 4.x: < 4.1.3
- KubeSphere Enterprise 3.x: >= 3.0.0, <= 3.5.0
## Workaround
Remove the non-essential resource authorization of the `authenticated` platform role:
```bash
kubectl patch globalrole.iam.kubesphere.io authenticated --type merge -p '{"rules": [{"apiGroups":["monitoring.kubesphere.io","metering.kubesphere.io","monitoring.coreos.com"],"resources":["cluster"],"verbs":["list"]},{"apiGroups":["resources.kubesphere.io"],"resources":["clusters"],"verbs":["get","list"]}]}'
```
This change strengthens the permission constraints on ordinary users. When an ordinary project member opens a page and wants to call these APIs that require privileges, a "forbidden" pop-up box will appear.
## Remediation Plan
The risk level of this vulnerability is not high. You can solve this problem through the above workaround. We will fix this issue in the next version KubeSphere 4.1.3, and the expected release time is January 2025.
## Security Commitment
KubeSphere is continuously committed to providing enterprise customers with a secure and reliable cloud-native full-stack solution. We value the trust of users in our platform and strive to ensure that our system meets the highest security and performance standards.
At the same time, the KubeSphere community expresses great gratitude to [Okan Kurtuluş](https://www.linkedin.com/in/okankurtuluss/) for the timely discovery of this problem and the active communication with us.
## More Information
For more details about CVE-2024-46528 and its solution, you can contact the KubeSphere support team at security@kubesphere.io.

View File

@ -0,0 +1,389 @@
---
title: 'KubeSphere v4 安装指南'
tag: 'KubeSphere, Kubernetes, KubeSphere v4, KubeSphere LuBan'
createTime: '2024-10-16'
author: 'Cauchy'
snapshot: 'https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-guide-cover.png'
---
日前KubeSphere v4 发布,相较于之前的版本,新版本在架构上有了颠覆性的变化。为了让社区的各位小伙伴能够丝滑的从旧版本过渡到新版本,我们特别推出本篇安装指南文章,以供参考。
关于 KubeSphere v4 的介绍,请阅读本文:[KubeSphere v4 开源并发布全新可插拔架构 LuBan](https://kubesphere.io/zh/news/kubesphere-v4-ga-announcement/)。
> 需要注意的是,目前不支持从 KubeSphere 3.4.1 版本直接升级到 v4 版本,需要先卸载原来的版本,再安装 v4 版本。
## 卸载 KubeSphere 3.4.1
> 注意:
> - 本文仅适用于测试环境,请不要直接在生产环境操作。
> - 如果需要在生产环境操作,请先在测试环境验证通过后再进行。
> - 卸载为高风险操作,执行该操作前,请明确您知道自己将要做什么。
> - 该操作会导致 KubeSphere 平台自身无法使用,但不会影响 KubeSphere 之外即 K8s 集群中运行的工作负载。
> - 该操作会删除 KubeSphere 所有的组件及相关数据,您可以在此之前对数据进行备份。
> - 您可以自主选择数据迁移工具,或等待社区的数据迁移方案,社区的迁移方案计划通过脚本帮助您备份平台账户、权限及相关的数据,在新版本安装好后,可将备份数据进行导入。
> - 如果您期望全面的数据迁移和升级,我们建议您可以考虑 [KubeSphere 企业版](https://m.qingcloud.com/page/23555798970015596/4c97b2026cb84249be20d94e71b647cf?cl_track=aec50)。
> - **社区郑重提醒您,务必谨慎操作。**
### 解绑集群
如果开启了多集群,请务必在卸载前将集群进行解绑。卸载 Host 集群前,请确保已经没有 Member 集群被当前集群纳管,且角色和账户等信息也会被删除。
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-1.png)
### 卸载 KubeSphere 3.4.1
针对待卸载集群执行该脚本。
**注意:**
1. 执行该脚本前请确保当前集群已从 Host 集群中解绑。
2. 请确认即将操作的集群是将要被卸载的集群。
3. 执行该脚本后会将集群中的 Prometheus 以及 Elasticsearch 删除,存量监控和日志数据不会被保留。
4. 执行该脚本后,集群中项目网关仍可继续使用,但纳管至 KubeSphere 4.1.2 后需将网关切换到新版本网关,切换过程存需删除老版本网关,切换为新版本网关。
#### 卸载 DevOps 组件
```
helm del -n argocd devops
helm del -n kubesphere-devops-system devops
```
#### 卸载 ServiceMesh 组件
```
kubectl -n istio-system delete jaeger jaeger
kubectl -n istio-system delete kiali kiali
helm del -n istio-system kiali-operator
helm del -n istio-system jaeger-operator
# 下载 istioctl
wget https://github.com/istio/istio/releases/download/1.15.6/istioctl-1.15.6-linux-amd64.tar.gz
tar -zxvf istioctl-1.15.6-linux-amd64.tar.gz
./istioctl uninstall --purge
```
#### 卸载 ks-core、监控及日志相关组件
```
#/bin/bash
############################################################################################################
# 该脚本用于卸载集群中的 KubeSphere v3.4.1
#
# 注意: 如果为多集群环境,执行该脚本前请确保当前集群已从 host 集群中解绑
############################################################################################################
set -x
# 清除集群所有 namespace 中的 workspace 标签
kubectl get ns -l kubesphere.io/workspace -o name | xargs -I {} bash -c "kubectl label {} kubesphere.io/workspace- && kubectl patch {} -p '{\"metadata\":{\"ownerReferences\":[]}}' --type=merge"
# # 清除集群所有 namespace 中的 kubefed 标签
kubectl get ns -l kubefed.io/managed -o name | xargs -I {} bash -c "kubectl label {} kubefed.io/managed- && kubectl patch {} -p '{\"metadata\":{\"ownerReferences\":[]}}' --type=merge"
# 清除集群中的 workspace 以及 workspacetemplate 资源
kubectl get workspacetemplate -A -o name | xargs -I {} kubectl patch {} -p '{"metadata":{"ownerReferences":[]}}' --type=merge
kubectl get workspace -A -o name | xargs -I {} kubectl patch {} -p '{"metadata":{"ownerReferences":[]}}' --type=merge
kubectl get workspacetemplate -A -o name | xargs -I {} kubectl delete {}
kubectl get workspace -A -o name | xargs -I {} kubectl delete {}
# 删除 clusterroles
delete_cluster_roles() {
for role in `kubectl get clusterrole -l iam.kubesphere.io/role-template -o jsonpath="{.items[*].metadata.name}"`
do
kubectl delete clusterrole $role 2>/dev/null
done
}
delete_cluster_roles
# 删除 clusterrolebindings
delete_cluster_role_bindings() {
for rolebinding in `kubectl get clusterrolebindings -l iam.kubesphere.io/role-template -o jsonpath="{.items[*].metadata.name}"`
do
kubectl delete clusterrolebindings $rolebinding 2>/dev/null
done
}
delete_cluster_role_bindings
# 删除 validatingwebhookconfigurations
for webhook in ks-events-admission-validate users.iam.kubesphere.io network.kubesphere.io validating-webhook-configuration resourcesquotas.quota.kubesphere.io
do
kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io $webhook 2>/dev/null
done
# 删除 mutatingwebhookconfigurations
for webhook in ks-events-admission-mutate logsidecar-injector-admission-mutate mutating-webhook-configuration
do
kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io $webhook 2>/dev/null
done
# 删除 users
for user in `kubectl get users -o jsonpath="{.items[*].metadata.name}"`
do
kubectl patch user $user -p '{"metadata":{"finalizers":null}}' --type=merge
done
kubectl delete users --all 2>/dev/null
# 删除 iam 资源
for resource_type in `echo globalrolebinding loginrecord rolebase workspacerole globalrole workspacerolebinding`; do
for resource_name in `kubectl get ${resource_type}.iam.kubesphere.io -o jsonpath="{.items[*].metadata.name}"`; do
kubectl patch ${resource_type}.iam.kubesphere.io ${resource_name} -p '{"metadata":{"finalizers":null}}' --type=merge
done
kubectl delete ${resource_type}.iam.kubesphere.io --all 2>/dev/null
done
# 卸载 ks-core
helm del -n kubesphere-system ks-core
helm del -n kubesphere-system ks-redis &> /dev/null || true
kubectl delete pvc -n kubesphere-system -l app=redis-ha --ignore-not-found || true
kubectl delete deploy -n kubesphere-system -l app.kubernetes.io/managed-by!=Helm --field-selector metadata.name=redis --ignore-not-found || true
kubectl delete svc -n kubesphere-system -l app.kubernetes.io/managed-by!=Helm --field-selector metadata.name=redis --ignore-not-found || true
kubectl delete secret -n kubesphere-system -l app.kubernetes.io/managed-by!=Helm --field-selector metadata.name=redis-secret --ignore-not-found || true
kubectl delete cm -n kubesphere-system -l app.kubernetes.io/managed-by!=Helm --field-selector metadata.name=redis-configmap --ignore-not-found || true
kubectl delete pvc -n kubesphere-system -l app.kubernetes.io/managed-by!=Helm --field-selector metadata.name=redis-pvc --ignore-not-found || true
kubectl delete deploy -n kubesphere-system --all --ignore-not-found
kubectl delete svc -n kubesphere-system --all --ignore-not-found
kubectl delete cm -n kubesphere-system --all --ignore-not-found
kubectl delete secret -n kubesphere-system --all --ignore-not-found
kubectl delete sa -n kubesphere-system --all --ignore-not-found
# 删除 Gateway 资源
for gateway in `kubectl -n kubesphere-controls-system get gateways.gateway.kubesphere.io -o jsonpath="{.items[*].metadata.name}"`
do
kubectl -n kubesphere-controls-system patch gateways.gateway.kubesphere.io $gateway -p '{"metadata":{"finalizers":null}}' --type=merge
done
kubectl -n kubesphere-controls-system delete gateways.gateway.kubesphere.io --all 2>/dev/null
# 删除crd
kubectl delete crd globalrolebindings.iam.kubesphere.io
kubectl delete crd globalroles.iam.kubesphere.io
kubectl delete crd users.iam.kubesphere.io
kubectl delete crd workspacerolebindings.iam.kubesphere.io
kubectl delete crd workspaceroles.iam.kubesphere.io
kubectl delete crd workspaces.tenant.kubesphere.io
kubectl delete crd workspacetemplates.tenant.kubesphere.io
kubectl delete crd gateways.gateway.kubesphere.io
## 卸载 监控组件
# 删除 Prometheus/ALertmanager/ThanosRuler
kubectl -n kubesphere-monitoring-system delete Prometheus k8s --ignore-not-found
kubectl -n kubesphere-monitoring-system delete secret additional-scrape-configs --ignore-not-found
kubectl -n kubesphere-monitoring-system delete serviceaccount prometheus-k8s --ignore-not-found
kubectl -n kubesphere-monitoring-system delete service prometheus-k8s --ignore-not-found
kubectl -n kubesphere-monitoring-system delete role prometheus-k8s-config --ignore-not-found
kubectl -n kubesphere-monitoring-system delete rolebinging prometheus-k8s-config --ignore-not-found
kubectl -n kubesphere-monitoring-system delete Alertmanager main --ignore-not-found
kubectl -n kubesphere-monitoring-system delete secret alertmanager-main --ignore-not-found
kubectl -n kubesphere-monitoring-system delete service alertmanager-main --ignore-not-found
kubectl -n kubesphere-monitoring-system delete ThanosRuler kubesphere --ignore-not-found
# 删除 ServiceMonitor/PrometheusRules
kubectl -n kubesphere-monitoring-system delete ServiceMonitor alertmanager coredns etcd ks-apiserver kube-apiserver kube-controller-manager kube-proxy kube-scheduler kube-state-metrics kubelet node-exporter prometheus prometheus-operator s2i-operator thanosruler --ignore-not-found
kubectl -n kubesphere-monitoring-system delete PrometheusRule kubesphere-rules prometheus-k8s-coredns-rules prometheus-k8s-etcd-rules prometheus-k8s-rules --ignore-not-found
# 删除 prometheus-operator
kubectl -n kubesphere-monitoring-system delete deployment prometheus-operator --ignore-not-found
kubectl -n kubesphere-monitoring-system delete service prometheus-operator --ignore-not-found
kubectl -n kubesphere-monitoring-system delete serviceaccount prometheus-operator --ignore-not-found
# 删除 kube-state-metrics/node-exporter
kubectl -n kubesphere-monitoring-system delete deployment kube-state-metrics --ignore-not-found
kubectl -n kubesphere-monitoring-system delete service kube-state-metrics --ignore-not-found
kubectl -n kubesphere-monitoring-system delete serviceaccount kube-state-metrics --ignore-not-found
kubectl -n kubesphere-monitoring-system delete daemonset node-exporter --ignore-not-found
kubectl -n kubesphere-monitoring-system delete service node-exporter --ignore-not-found
kubectl -n kubesphere-monitoring-system delete serviceaccount node-exporter --ignore-not-found
# 删除 Clusterrole/ClusterRoleBinding
kubectl delete clusterrole kubesphere-prometheus-k8s kubesphere-kube-state-metrics kubesphere-node-exporter kubesphere-prometheus-operator
kubectl delete clusterrolebinding kubesphere-prometheus-k8s kubesphere-kube-state-metrics kubesphere-node-exporter kubesphere-prometheus-operator
# 删除 notification-manager
helm delete notification-manager -n kubesphere-monitoring-system
# 清理 kubesphere-monitoring-system
kubectl delete deploy -n kubesphere-monitoring-system --all --ignore-not-found
# 删除监控 crd
kubectl delete crd alertmanagerconfigs.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
kubectl delete crd podmonitors.monitoring.coreos.com
kubectl delete crd probes.monitoring.coreos.com
kubectl delete crd prometheusagents.monitoring.coreos.com
kubectl delete crd prometheuses.monitoring.coreos.com
kubectl delete crd prometheusrules.monitoring.coreos.com
kubectl delete crd scrapeconfigs.monitoring.coreos.com
kubectl delete crd servicemonitors.monitoring.coreos.com
kubectl delete crd thanosrulers.monitoring.coreos.com
kubectl delete crd clusterdashboards.monitoring.kubesphere.io
kubectl delete crd dashboards.monitoring.kubesphere.io
# 删除 metrics-server
kubectl delete apiservice v1beta1.metrics.k8s.io
kubectl -n kube-system delete deploy metrics-server
kubectl -n kube-system delete service metrics-server
kubectl delete ClusterRoleBinding system:metrics-server
kubectl delete ClusterRoleBinding metrics-server:system:auth-delegator
kubectl -n kube-system delete RoleBinding metrics-server-auth-reader
kubectl delete ClusterRole system:metrics-server
kubectl delete ClusterRole system:aggregated-metrics-reader
kubectl -n kube-system delete ServiceAccount ServiceAccount
## 卸载 日志组件
# 删除 fluent-bit
kubectl -n kubesphere-logging-system delete fluentbitconfigs fluent-bit-config --ignore-not-found
kubectl -n kubesphere-logging-system patch fluentbit fluent-bit -p '{"metadata":{"finalizers":null}}' --type=merge
kubectl -n kubesphere-logging-system delete fluentbit fluent-bit --ignore-not-found
# 删除 ks-logging
helm del -n kubesphere-logging-system logsidecar-injector &> /dev/null || true
# 删除 ks-events
helm del -n kubesphere-logging-system ks-events &> /dev/null || true
# 删除 kube-auditing
helm del -n kubesphere-logging-system kube-auditing &> /dev/null || true
# 删除 es
helm del -n kubesphere-logging-system elasticsearch-logging &> /dev/null || true
helm del -n kubesphere-logging-system elasticsearch-logging-curator &> /dev/null || true
# 删除 opensearch
helm del -n kubesphere-logging-system opensearch-master &> /dev/null || true
helm del -n kubesphere-logging-system opensearch-data &> /dev/null || true
helm del -n kubesphere-logging-system opensearch-logging-curator &> /dev/null || true
# 清理 kubesphere-logging-system
kubectl delete deploy -n kubesphere-logging-system --all --ignore-not-found
```
#### 检查 Namespace 标签
确认所有 Namespace 不包含 `kubesphere.io/workspace` 标签。
```
kubectl get ns --show-labels
```
#### 卸载 KubefedHost 集群)
```
helm del -n kube-federation-system kubefed
```
## 安装 KubeSphere 4.1.2
### 升级 Crd
```
# 下载 ks-core chart 包
helm fetch https://charts.kubesphere.io/main/ks-core-1.1.2.tgz --untar
# 更新 crds
kubectl apply -f ks-core/charts/ks-crds/crds/
```
### Host 集群安装 ks-core
自 KubeSphere v4.1 开始,仅需在 Host 集群部署 ks-core 即可Member 集群通过页面添加(切勿在 Member 集群再次部署 ks-core
```
# 该命令仅需在 host 集群上执行
# 如果访问 dockerhub 受限,在以下命令中添加
# --set global.imageRegistry=swr.cn-southwest-2.myhuaweicloud.com/ks
# --set extension.imageRegistry=swr.cn-southwest-2.myhuaweicloud.com/ks
helm upgrade --install -n kubesphere-system --create-namespace ks-core https://charts.kubesphere.io/main/ks-core-1.1.2.tgz --debug --wait
```
### 添加 Member 集群
Host 集群部署好之后,进入工作台点击**集群管理**
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-2.png)
点击**添加集群**
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-3.png)
填写集群信息,并点击**下一步**
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-4.png)
填写 Member 集群 Kubeconfig
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-5.png)
填写集群配置:
```
# 如果访问 dockerhub 受限,此处可填,如果能够正常访问 dockerhub可跳过该步骤。
global:
imageRegistry: swr.cn-southwest-2.myhuaweicloud.com/ks
```
![](http://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-6.png)
点击创建后等待 Member 集群上的 ks-agent 创建成功。
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-7.png)
### Gateway 迁移
#### 安装 Gateway 组件
安装 KubeSphere 网关扩展组件,并为需要使用网关的集群安装 Gateway 扩展组件 Agent。
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-8.png)
#### 将使用了项目网关的项目加入目标企业空间
执行卸载脚本时,会删除项目的企业空间关联关系,需将使用了项目网关的项目重新加入新的目标企业空间中。
#### 迁移项目网关到新版本
**注意:该步骤会导致项目网关中断,需提前考虑业务影响。**
##### 删除待迁移项目网关
如需保证访问端口不变,删除前务必记录对应网关的 Nodeport 信息或者 LoadBalancer 信息,以便在新创建网关时保留原有配置。
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-9.png)
##### 新建项目网关
通过企业空间进入到项目的项目设置中的网关设置。
以保留原有网关的 Nodeport 为例:
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-10.png)
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-11.png)
点击确定。
##### 关联应用路由至新建网关
待新的项目网关创建成功后,在网关页面中点击管理->编辑,复制其中的 IngressClassName。
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-12.png)
针对当前项目下的应用路由,点击编辑 YAML。
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-13.png)
Spec 添加 ingressClassName: xxx保存。
![](https://pek3b.qingstor.com/kubesphere-community/images/ks-v4-install-guide-14.png)
## 总结
以上就是 KubeSphere v4 安装的完整步骤,供大家参考。如果您在安装过程中出现问题,可去论坛搜索是否有解答,如没有,可在论坛提问: https://ask.kubesphere.io/forum/。

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

@ -23,7 +23,7 @@ endif::[]
== 创建 DevOps 项目
. 以 **project-admin** 用户登录{ks_product_both} Web 控制台,进入一个企业空间。
. 以 **project-admin** 用户登录{ks_product_left} Web 控制台,进入一个企业空间。
. 点击 **DevOps 项目**,然后点击**创建**。

View File

@ -64,7 +64,8 @@ DevOps 中的图形编辑面板包含用于 Jenkins link:https://www.jenkins.io/
|说明
|
如果您的账户或密码中包含任何特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,请先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
如果您的账户或密码中包含特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,请先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
|===
[%header,cols="1a,2a,2a"]
@ -81,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]。点击**确定**完成操作。
. 创建完成后,您将在凭证页面看到已创建的凭证。
@ -250,7 +251,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/nested_step.png[,100%]
. 点击 **Sonarqube 配置**,在弹出的对话框中保持默认名称 **sonar** 不变,点击**确定**保存操作。
. 点击 **Sonarqube 配置**,在弹出的对话框中输入名称 **sonar**,点击**确定**保存操作。
+
image:/images/ks-qkcp/zh/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/sonar_env.png[,100%]

View File

@ -65,7 +65,7 @@ Jenkinsfile in SCM 需要源代码管理 (SCM) 中有内置 Jenkinsfile换句
== 步骤 1创建凭证
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在 **DevOps 项目设置**下的**凭证**页面创建以下凭证。有关如何创建凭证的更多信息请参阅link:../../05-devops-settings/01-credential-management/[凭证管理]。
+
@ -76,7 +76,7 @@ Jenkinsfile in SCM 需要源代码管理 (SCM) 中有内置 Jenkinsfile换句
|说明
|
如果您的账户或密码中包含任何特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,请先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
如果您的账户或密码中包含特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,请先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
|===
[%header,cols="1a,2a,2a"]
@ -97,7 +97,7 @@ Jenkinsfile in SCM 需要源代码管理 (SCM) 中有内置 Jenkinsfile换句
|===
--
. 再为 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]。点击**确定**完成操作。
. 还需要创建具有如下图所示权限的 GitHub 个人访问令牌 (PAT),然后在 DevOps 项目中,使用生成的令牌创建用于 GitHub 认证的账户凭证(例如,**github-token**)。
+
@ -210,7 +210,7 @@ Jenkinsfile 中 **mvn** 命令的参数 **-o** 表示开启离线模式。本教
== 步骤 3创建流水线
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在**流水线**页面点击**创建**。
@ -358,7 +358,7 @@ input(id: 'release-image-with-tag', message: 'release image with tag?', submitte
----
--
. 以具有流水线审核权限的用户登录{ks_product_both} Web 控制台,点击**企业空间管理**并进入您的 DevOps 项目,点击流水线名称进入详情页。在**运行记录**页签下,点击要审核的记录,点击**继续**以批准流水线。
. 以具有流水线审核权限的用户登录{ks_product_left} Web 控制台,点击**企业空间管理**并进入您的 DevOps 项目,点击流水线名称进入详情页。在**运行记录**页签下,点击要审核的记录,点击**继续**以批准流水线。
//note
[.admon.note,cols="a"]
@ -416,7 +416,7 @@ input(id: 'release-image-with-tag', message: 'release image with tag?', submitte
// == 步骤 7访问示例服务
// . 以 **platform-admin** 用户登录{ks_product_both} Web 控制台。
// . 以 **platform-admin** 用户登录{ks_product_left} Web 控制台。
// . 进入 **kubesphere-sample-dev** 项目,在**应用负载**下的**服务**中点击 **ks-sample-dev**。在详情页获取 Endpoint 用于访问该服务。

View File

@ -34,7 +34,7 @@ CI & CD 流水线模板包含六个阶段。有关每个阶段的更多信息,
下面以 Node.js 为例演示如何使用内置流水线模板。使用 Maven 以及 Golang 流水线模板的操作基本相同。
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在**流水线**页面点击**创建**。

View File

@ -21,7 +21,7 @@ link:https://gitlab.com/users/sign_in[GitLab] 是一款基于 web 的 Git 仓库
== 步骤 1创建凭证
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在 **DevOps 项目设置**下的**凭证**中创建以下凭证。有关如何创建凭证的更多信息请参阅link:../../05-devops-settings/01-credential-management/[凭证管理]。
+
@ -32,7 +32,7 @@ link:https://gitlab.com/users/sign_in[GitLab] 是一款基于 web 的 Git 仓库
|说明
|
如果您的账户或密码中包含任何特殊字符,例如 **@** 和 **$**,则可能会因为无法识别而在流水线运行时导致错误。在此情况下,您需要先在第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
如果您的账户或密码中包含特殊字符,例如 **@** 和 **$**,则可能会因为无法识别而在流水线运行时导致错误。在此情况下,您需要先在第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
|===
@ -108,7 +108,7 @@ link:https://gitlab.com/users/sign_in[GitLab] 是一款基于 web 的 Git 仓库
== 步骤 3创建流水线
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在**流水线**页面点击**创建**。

View File

@ -23,7 +23,7 @@ weight: 06
=== 获取 webhook URL
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。
@ -66,7 +66,7 @@ weight: 06
== 检查流水线状态
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。

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 仪表板]并点击左侧导航栏中的**系统管理**。
. 向下滚动并点击**系统配置**。
@ -58,7 +58,7 @@ weight: 08
=== 创建流水线
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目,在**流水线**页面点击**创建**。

View File

@ -20,7 +20,7 @@ weight: 03
== 导入代码仓库
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。

View File

@ -18,7 +18,7 @@ weight: 04
== 操作步骤
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。

View File

@ -32,7 +32,7 @@ weight: 01
== 创建凭证
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。
@ -78,7 +78,7 @@ weight: 01
|
* 自 2021 年 8 月起GitHub 要求使用基于令牌的身份验证,此处需要输入令牌,而非 GitHub 密码。有关如何生成令牌请参阅link:https://docs.github.com/cn/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token[创建个人访问令牌]。
* 如果您的账户或密码中包含任何特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,您需要先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
* 如果您的账户或密码中包含特殊字符,例如 **@** 和 **$**,可能会因为无法识别而在流水线运行时导致错误。在这种情况下,您需要先在一些第三方网站(例如 link:https://www.urlencoder.org/[urlencoder])上对账户或密码进行编码,然后将输出结果复制粘贴作为您的凭证信息。
|===
--

View File

@ -46,7 +46,7 @@ weight: 02
== 创建 DevOps 项目角色
. 以 **devops-admin** 用户登录{ks_product_both} Web 控制台。
. 以 **devops-admin** 用户登录{ks_product_left} Web 控制台。
. 前往 **DevOps 项目**页面点击一个 DevOps 项目(例如 **demo-devops**)。
+

View File

@ -20,7 +20,7 @@ weight: 03
== 操作步骤
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。

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,37 +240,62 @@ 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。
. 执行以下命令:
+
--
// Bash
[,bash]
[,bash]{ks_product_left} Web
----
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

@ -88,7 +88,7 @@ sudo systemctl restart docker
== 创建凭证
. 以 **project-regular** 用户登录{ks_product_both} Web 控制台。
. 以 **project-regular** 用户登录{ks_product_left} Web 控制台。
. 点击**企业空间管理**并进入您的 DevOps 项目。
. 在 **DevOps 项目设置**下的**凭证**页面为 Harbor 创建凭证。
. 在**创建凭证**页面,设置凭证 ID (**robot-test**)**类型**选择**用户名和密码****用户名**字段必须和您刚刚下载的 JSON 文件中 **name** 的值相同,并在**密码/令牌**中输入 Harbor 令牌文件中 **token** 的值。
@ -128,7 +128,7 @@ pipeline {
HARBOR_NAMESPACE = 'ks-devops-harbor'
// Docker 镜像名称。
APP_NAME = 'docker-example'
// robot-test是您在{ks_product_both} Web 控制台上创建的凭证 ID。
// robot-test是您在{ks_product_left} Web 控制台上创建的凭证 ID。
HARBOR_CREDENTIAL = credentials('robot-test')
}

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功能在此版本暂不可用

View File

@ -22,6 +22,8 @@ sectionLink:
- /docs/v4.1/09-project-management/06-project-settings/02-project-roles/01-create-a-project-role.adoc
- /docs/v4.1/06-extension-user-guide/01-install-components-pdf.adoc
- /docs/v4.1/10-toolbox/01-use-kubectl-tool.adoc
- docs/v4.1/11-use-extensions/01-devops/03-how-to-use/02-pipelines/01-create-a-pipeline-using-graphical-editing-panel.adoc
- docs/v4.1/11-use-extensions/01-devops/03-how-to-use/02-pipelines/02-create-a-pipeline-using-jenkinsfile.adoc
section3:
title: 在云服务上运行 KubeSphere 与 Kubernetes 技术栈

View File

@ -0,0 +1,40 @@
---
title: '关于 KubeSphere IDOR 安全漏洞 CVE-2024-46528 的声明及解决方案'
tag: '产品动态'
keywords: 'Kubernetes, KubeSphere, IDOR, 安全漏洞'
description: '在 KubeSphere 开源版 3.4.1 及 4.1.1 上存在不安全的直接对象引用IDOR的漏洞。'
createTime: '2024-10-17'
author: 'KubeSphere'
image: 'https://pek3b.qingstor.com/kubesphere-community/images/kubesphere-idor-cve-cover.png'
---
近期,有第三方平台的安全技术人员发现了在 KubeSphere 开源版 3.4.1 及 4.1.1 上存在不安全的直接对象引用IDOR的漏洞该漏洞允许低权限的通过认证的攻击者在没有适当授权检查的情况下访问敏感资源。我们及时与对方进行了联系并帮助对方解决了此问题CVE 漏洞的详细信息及问题处理过程可以参考以下链接:
- [CVE-2024-46528](https://nvd.nist.gov/vuln/detail/CVE-2024-46528)
- [IDOR Vulnerability in KubeSphere](https://okankurtulus.com.tr/2024/09/09/idor-vulnerability-in-kubesphere/)
## 影响范围
- KubeSphere 4.x 受影响版本: < 4.1.3
- KubeSphere 3.x 受影响版本: >= 3.0.0, <= 3.4.1
- KubeSphere Enterprise 4.x 受影响版本: < 4.1.3
- KubeSphere Enterprise 3.x 受影响版本: >= 3.0.0, <= 3.5.0
## 规避方案
移除 `authenticated` 平台角色非必需的资源授权:
```bash
kubectl patch globalrole.iam.kubesphere.io authenticated --type merge -p '{"rules": [{"apiGroups":["monitoring.kubesphere.io","metering.kubesphere.io","monitoring.coreos.com"],"resources":["cluster"],"verbs":["list"]},{"apiGroups":["resources.kubesphere.io"],"resources":["clusters"],"verbs":["get","list"]}]}'
```
此变更加强了对普通用户的权限约束,普通的项目成员在打开的页面,如果要调用这些需要特权 API 的时候会有 Forbidden 弹框。
## 未来的修复计划
此漏洞风险等级不高,您可以通过以上规避方案解决此问题,同时,我们也会在 KubeSphere 下一个正式版本 4.1.3 中修复此问题,预计发布时间为 2025 年 1 月份。
## 对安全的承诺
KubeSphere 持续致力于为企业客户提供安全可靠的云原生全栈解决方案。我们重视用户对我们平台的信任,并努力确保我们的系统符合最高的安全和性能标准。
同时KubeSphere 社区对 [Okan Kurtuluş](https://www.linkedin.com/in/okankurtuluss/) 对此问题的及时发现以及与我们的积极沟通表示极大的感谢。
## 更多信息
寻求有关 CVE-2024-46528 及其解决方案的更多详情的用户可以联系 KubeSphere 支持团队,联系方式为 **security@kubesphere.io**