Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs update on kubelet authn authz #696

Merged
merged 11 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs/zh_cn/administration/going-production.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,42 @@ spec:
- --leader-election-lease-duration=15s # Leader 的间隔,默认为 15s
...
```

## 启用 Kubelet authentication webhook {#authentication-webhook}

如果 kubelet 没有启用 Authentication webhook,会导致 CSI Node 获取 Pod 列表时报错(该报错本身已经修复,见后续描述):

```
kubelet_client.go:99] GetNodeRunningPods err: Unauthorized
reconciler.go:70] doReconcile GetNodeRunningPods: invalid character 'U' looking for beginning of value
```

面对这种情况,我们建议[启用 Kubelet authentication webhook](../administration/going-production.md#authentication-webhook)。

```yaml {5,8} title="/var/lib/kubelet/config.yaml"
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
webhook:
cacheTTL: 0s
enabled: true
...
authorization:
mode: Webhook
...
```

在 v0.21.0 及其后版本,就算未启用上方的 Authentication webhook,CSI Node 也不再会出现异常、而是绕过 kubelet,直接访问 APIServer 去获取信息(比如 `ListPod`),这种情况会产生少量额外的性能开销。因此在生产集群,我们仍推荐启用 Authentication webhook。

需要注意,就算使用了 v0.21.0 及之后的版本,CSI 驱动需要配置 `podInfoOnMount: true`,上边提到的避免报错的特性才会真正生效。如果你采用 [Helm 安装方式](../getting_started.md#helm),该问题并不存在,因为 `podInfoOnMount` 已经写死安装文件里,随着升级自动启用。而如果你使用 kubectl 直接安装,你需要为 `k8s.yaml` 添加如下配置:
timfeirg marked this conversation as resolved.
Show resolved Hide resolved

```yaml {6} title="k8s.yaml"
...
apiVersion: storage.k8s.io/v1
kind: CSIDriver
...
spec:
podInfoOnMount: true
...
```

这也是为什么在生产环境,我们推荐用 Helm 安装 CSI 驱动,避免手动维护的 `k8s.yaml`,在升级时带来额外的心智负担。
9 changes: 8 additions & 1 deletion docs/zh_cn/administration/troubleshooting-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ kubernetes.io/csi: attacher.MountDevice failed to create newCsiDriverClient: dri
/var/lib/kubelet/csi-plugins/csi.juicefs.com/csi.sock: connect: no such file or directory
```

此时需要[检查 CSI Node](./troubleshooting.md#check-csi-node),确认其异常原因,并排查修复。
此时需要[检查 CSI Node](./troubleshooting.md#check-csi-node),确认其异常原因,并排查修复。常见的问题比如 kubelet 没有启用 Authentication webhook,导致获取 Pod 列表时报错:

```
kubelet_client.go:99] GetNodeRunningPods err: Unauthorized
reconciler.go:70] doReconcile GetNodeRunningPods: invalid character 'U' looking for beginning of value
```

面对这种情况,我们建议[启用 Kubelet authentication webhook](../administration/going-production.md#authentication-webhook)。

## Mount Pod 异常 {#mount-pod-error}

Expand Down
18 changes: 8 additions & 10 deletions docs/zh_cn/guide/pv.md
Original file line number Diff line number Diff line change
Expand Up @@ -711,17 +711,19 @@ spec:

### PV 容量分配 {#storage-capacity}

目前而言,JuiceFS CSI 驱动仅支持为动态 PersistentVolume 设置存储容量。在静态 PersistentVolume 与其 PersistentVolumeClaim 中指定的容量会被忽略,填写任意有效值即可,例如 `100Gi`:
从 v0.19.3 开始,JuiceFS CSI 驱动支持在动态配置设置存储容量(要注意,仅支持动态配置)。

在静态配置中,PVC 中指定的容量会被忽略,填写任意有效值即可,建议填写一个较大的数值,避免未来版本如果带来该功能支持时,因为容量超限导致问题。

```yaml
...
storageClassName: ""
resources:
requests:
storage: 100Gi
storage: 10Ti
```

而在使用 StorageClass 的 PersistentVolumeClaim 中指定存储容量是有效的:
而在动态配置中,可以在 PVC 中指定存储容量,这个容量限制将会被翻译成 `juicefs quota` 命令,在 CSI Controller 中执行,为该 PV 所对应的子目录添加容量限制。关于 `juicefs quota` 命令,可以参考[社区版文档](https://juicefs.com/docs/zh/community/command_reference/#quota),商业版文档待补充。

```yaml
...
Expand All @@ -731,18 +733,14 @@ resources:
storage: 100Gi
```

:::note 注意
存储容量只对该 PersistentVolumeClaim 所使用的子目录有效,不会影响整个 JuiceFS volume 的存储配额。
:::

我们可以在应用 Pod 中使用 `df` 查看存储容量:
创建并挂载好 PV 后,可以进入容器用 `df -h` 验证容量生效:

```bash
```shell
$ df -h
Filesystem Size Used Avail Use% Mounted on
overlay 84G 66G 18G 80% /
tmpfs 64M 0 64M 0% /dev
JuiceFS:ce-secret 100G 0 100G 0% /data-0
JuiceFS:myjfs 100G 0 100G 0% /data-0
```

### PV 扩容 {#pv-resize}
Expand Down