Helm安装NeuVector并集成Rancher

问题需求

Rancher 每个版本会固定集成 5.x 的 NeuVector 版本。而实际上 NeuVector 不仅限于 Rancher 的版本,通常会支持更多的 k8s 版本。

参考文档:https://open-docs.neuvector.com/basics/requirements/#supported-platforms

此时如果 Rancher 版本较低,则无法安装较新的 NeuVector 版本,我们可以通过 Helm 方式安装 NeuVector,并集成 Rancher。

步骤

  1. 添加 Helm 仓库
1
helm repo add neuvector https://neuvector.github.io/neuvector-helm
  1. 查找需要安装的版本
1
helm search repo neuvector/core -l
  1. 导出 values 并命名为 custom-values.yaml
1
helm show values neuvector/core --version 2.8.6 > custom-values.yaml
  1. 修改 values.yaml 文件
1
2
3
4
5
6
7
8
9
10
11
12
## 1. 修改 url 为 Rancher 的访问地址
global: # required for rancher authentication (https://<Rancher_URL>/)
cattle:
url: https://192.168.2.51:444

## 2. 开启 sso
controller:
ranchersso: # required for rancher authentication
enabled: true

## 3. rbac 也需要开启,但是这个默认就开启了,所以不用修改
rbac: true
  1. 安装 NeuVector
1
helm install neuvector neuvector/core --version 2.8.6 -n cattle-neuvector-system  --create-namespace -f custom-values.yaml 

这里重点是需要安装在 cattle-neuvector-system namespace 下,Rancher 会识别这个 namespace。

当安装好之后,就可以通过 Rancher UI 访问 NeuVector 并自动登录。