minikube 有很多 space,但是 pod 说设备上没有剩余 space

minikube's got loads of space, but the pod says no space left on device

我正在尝试 运行 在我的 mac 上的 minikube 上进行 Elasticsearch。我正在按照 Elasticsearch helm repo here.

中的说明进行操作

我是这样启动 minikube 的:

minikube start --memory 8192 --cpus 4 --disk-size 50000mb

开始正常,表明包含了 Elasticsearch helm minikube 示例自述文件中列出的插件。

  Enabled addons: storage-provisioner, default-storageclass

版本:

➜ minikube version
minikube version: v1.23.1
commit: 84d52cd81015effbdd40c632d9de13db91d48d43

➜ kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.1", GitCommit:"632ed300f2c34f6d6d15ca4cef3d3c7073412212", GitTreeState:"clean", BuildDate:"2021-08-19T15:38:26Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.1", GitCommit:"632ed300f2c34f6d6d15ca4cef3d3c7073412212", GitTreeState:"clean", BuildDate:"2021-08-19T15:39:34Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"}

我用 helm init 初始化 helm,然后用

启动 elasticsearch
helm install --name elasticsearch elastic/elasticsearch -f values.yaml

这些值来自这里https://github.com/elastic/helm-charts/blob/master/elasticsearch/examples/minikube/values.yaml并要求elasticsearch允许一个节点上的所有pods到运行,并请求更少的资源。

我查看了 elasticsearch pods(有三个),他们都抱怨同一件事:

MountVolume.SetUp failed for volume "kube-api-access-lxmxc" : write /var/lib/kubelet/pods/5ce1f0e8-6d43-48a0-bac6-55eab6eafc97/volumes/kubernetes.io~projected/kube-api-access-lxmxc/..2021_09_19_06_47_54.897372328/namespace: no space left on device

所以我登录到 minikube VM 并导航到该文件夹​​并检查 space:

➜ minikube ssh
                         _             _
            _         _ ( )           ( )
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

$ cd /var/lib/kubelet
$ df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        43G  1.5G   39G   4% /var/lib/kubelet
$ df -ih .
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/vda1         25M   13K   25M    1% /var/lib/kubelet

这看起来不错(虽然我不会假装我理解什么是 inode)。

我的问题是我不确定接下来要看哪里?我有一个 pod 说“设备上没有足够的 space”,还有一个设备说“实际上我有很多 space!”很明显我错过了真正的问题。但我不知道它到底是什么!

Turns out the latest helm chart has some bugs, so I reset to an earlier tag and tried again and all good! I didn't learn anything though, other than that helm charts can have bugs.

让我试着向你解释一下。通常,您根本不应该使用 latest 标签。 Helm 需要一个图像和它的特定版本。查看此示例以了解 alpine image:

The latest docker tag is the latest release version (https://github.com/helm/helm/releases/latest)

Please avoid to use latest tag for any production deployment. Tag with right version is the proper way, such as alpine/helm:3.1.1

你也可以从这篇文章中学到很多东西:What's Wrong With The Docker :latest Tag?。它与 docker 相关,但在 Helm 中您使用这些图像。注意如果您使用 latest 标签会发生什么。

你也可以阅读这个good article。它解释了如何正确创建 helm 图表:

We will use AppVersion as the Docker image tag for our application. That allows us to upgrade Helm chart with new version of Application by just changing value in Chart.yaml

image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"

因此,无论何时使用 helm chart,都应该确定使用的是什么镜像和版本。我同意您可以看到包含标签 latest 的图像。您可以随时更改它 ;)