设置GCP档案和Kubernetes



如何将档案安装到gcp

中的kubernetes pod

我确实遵循了文档,但是豆荚仍在等待

我做到了:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: <some name>
spec:
  capacity:
    storage: 50Gi
  accessModes:
  - ReadWriteMany
  nfs:
    path: /
    server: <filestorage_ip with this format xx.xxx.xxx.xx>
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: <some name>
  namespace: <some name>
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: ""
  resources:
    requests:
      storage: 50Gi
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: <some name>
  name: <some name>
  labels:
    app: <some name>
spec:
  replicas: 2
  selector:
    matchLabels:
      app: <some name>
  template:
    metadata:
      labels:
        app: <some name>
    spec:
      containers:
      - name: <some name>
        image: gcr.io/somepath/<some name>@sha256:<some hash>
        ports:
        - containerPort: 80 
        volumeMounts:
          - name: <some name>
            mountPath: /var/www/html
        imagePullPolicy: Always
      restartPolicy: Always
      volumes:
        - name: <some name>
          persistentVolumeClaim:
            claimName: <some name>
            readOnly: false

运行kubectl -n <some name> describe pods返回:

Events:
  Type     Reason       Age                     From                                                        Message
  ----     ------       ----                    ----                                                        -------
  Warning  FailedMount  23m (x52 over 3h21m)    kubelet, gke-<some name>-default-pool-<some hash>  Unable to mount volumes for pod "<some name>-<some hash>_<some name>(<some hash>)": timeout expired waiting for volumes to attach or mount for pod "<some name>"/"<some name>-<some hash>". list of unmounted volumes=[<some name>-persistent-storage]. list of unattached volumes=[<some name>-persistent-storage default-token-<some hash>]
  Warning  FailedMount  3m5s (x127 over 3h21m)  kubelet, gke-<some name>-default-pool-<some hash>  (combined from similar events): MountVolume.SetUp failed for volume "<some name>-storage" : mount failed: exit status 1
Mounting command: systemd-run
Mounting arguments: --description=Kubernetes transient mount for /var/lib/kubelet/pods/<some path>/volumes/kubernetes.io~nfs/<some name>-storage --scope -- /home/kubernetes/containerized_mounter/mounter mount -t nfs <filestorage_ip with this format xx.xxx.xxx.xx>:/ /var/lib/kubelet/pods/<some hash>/volumes/kubernetes.io~nfs/<some name>-storage
Output: Running scope as unit: run-<some hash>.scope
Mount failed: mount failed: exit status 32
Mounting command: chroot
Mounting arguments: [/home/kubernetes/containerized_mounter/rootfs mount -t nfs <filestorage_ip with this format xx.xxx.xxx.xx>:/ /var/lib/kubelet/pods/<some hash>/volumes/kubernetes.io~nfs/<some name>-storage]
Output: mount.nfs: access denied by server while mounting <filestorage_ip with this format xx.xxx.xxx.xx>:/

似乎POD无法访问FileStorage服务的IP在文档中说需要在相同的VPC

"授权网络 *文件实例只能从授权VPC网络上的计算机上访问。选择需要访问的网络。"

,但我不知道如何将kubernetes群集添加到VPC

有什么建议?

我发现了问题

PersistentVolume不能安装在path: /中它需要使您在创建中填写的"文件共享属性"字段现在与多个豆荚一起使用!

相关内容

  • 没有找到相关文章

最新更新