登录
首页 >  Golang >  Go问答

GKE中部署/Pod挂载卷超时等待条件

来源:stackoverflow

时间:2024-03-18 10:54:28 475浏览 收藏

在 GKE 中部署时,使用卷挂载的 Pod 可能会遇到超时等待条件。这可能会影响访问主文档存储磁盘和 NFS 服务。日志显示与文件系统访问相关的错误,并且默认的谷歌服务帐户令牌卷也无法安装。这种情况可能是由于 GKE 更新造成的,影响了以前的版本。

问题内容

我们遇到了 gke 卷使用问题。

从今晚开始,我们的部署无法再访问我们的主文档存储磁盘,日志如下所示:

...
    /go/src/github.com/def/abc/backend/formulare/formulare_generate_http.go:62 +0x55
    github.com/def/abc/backend/formulare.createdirsifneeded(0xc000b9b1d0, 0x2e, 0x0, 0x0)
    /usr/local/go/src/os/path.go:20 +0x39
    os.mkdirall(0xc000b9b1d0, 0x25, 0xc0000001ff, 0x25, 0xc000e75b18)
    /usr/local/go/src/os/stat.go:13 +0x4d
    os.stat(0xc000b9b1d0, 0x25, 0xc000b9b1d0, 0x0, 0xc000b9b1d0, 0x25)
    /usr/local/go/src/os/stat_unix.go:31 +0x77
    os.statnolog(0xc000b9b1d0, 0x25, 0xc000171ac8, 0x2, 0x2, 0xc000b9b1d0)
    /usr/local/go/src/os/file_posix.go:245
    os.ignoringeintr(...)
    /usr/local/go/src/os/stat_unix.go:32
    os.statnolog.func1(...)
    /usr/local/go/src/syscall/syscall_linux_amd64.go:66
    syscall.stat(...)
    /usr/local/go/src/syscall/zsyscall_linux_amd64.go:1440 +0xd2
    syscall.fstatat(0xffffffffffffff9c, 0xc000b9b1d0, 0x25, 0xc001a90378, 0x0, 0xc000171ac0, 0x4f064b)
    /usr/local/go/src/syscall/asm_linux_amd64.s:43 +0x5
    syscall.syscall6(0x106, 0xffffffffffffff9c, 0xc000b9b200, 0xc001a90378, 0x0, 0x0, 0x0, 0xc000ba4400, 0x0, 0xc000171a08)
    goroutine 808214 [syscall, 534 minutes]:

在 gke 上重新创建 pv/pvc 和 nfs 服务器后,pv/pvc 已成功绑定,但 nfs 服务甚至不再启动,因为它无法绑定磁盘:

warning  failedmount  95s (x7 over 15m)  kubelet          
  unable to attach or mount volumes: unmounted volumes=[document-storage-claim default-token-sbxxl], unattached volumes=[document-storage-claim default-token-sbxxl]: timed out waiting for the condition

奇怪的是,默认的谷歌服务帐户令牌卷也无法安装。

这可能是谷歌的问题吗?我需要更改我的 nfs 服务器配置吗?

这是我的 k8s 定义:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: document-storage-claim
  namespace: default
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: standard
  volumeName: document-storage
  resources:
    requests:
      storage: 250Gi

--- 

apiVersion: v1
kind: PersistentVolume
metadata:
  name: document-storage
  namespace: default
spec:
  storageClassName: standard
  capacity:
    storage: 250Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  gcePersistentDisk:
    pdName: document-storage-clone
    fsType: ext4

--- 

apiVersion: v1
kind: ReplicationController
metadata:
  name: document-storage-nfs-server
spec:
  replicas: 1
  selector:
    role: nfs-server
  template:
    metadata:
      labels:
        role: nfs-server
    spec:
      securityContext:
        fsGroup: 1000
      containers:
        - name: nfs-server
          image: k8s.gcr.io/volume-nfs:0.8
          ports:
            - name: nfs
              containerPort: 2049
            - name: mountd
              containerPort: 20048
            - name: rpcbind
              containerPort: 111
          securityContext:
            privileged: true
          volumeMounts:
            - mountPath: /exports
              name: document-storage-claim
      volumes:
        - name: document-storage-claim
          persistentVolumeClaim:
            claimName: document-storage-claim

正确答案


Google 似乎在 2020 年 4 月 20 日夜间推出了 GKE 更新。不知何故,此更新也影响了以前的版本(在我们的示例中为 1.18.16-gke.502)。

我们通过升级到 1.19.8-gke.1600 解决了该问题。

其他可能的解决方法是:

  • 创建有问题的卷的克隆并将其重新装载到您的部署中。
  • 重新部署您的节点池。

好了,本文到此结束,带大家了解了《GKE中部署/Pod挂载卷超时等待条件》,希望本文对你有所帮助!关注golang学习网公众号,给大家分享更多Golang知识!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>