【问题标题】:Multidrive access for Kubernetes NodesKubernetes 节点的多驱动器访问
【发布时间】:2018-10-23 17:46:22
【问题描述】:

所以,请原谅我。一个月前刚开始学习docker和kubernets。

我已经完成了我的 .yml 文件,该文件可以获取我的 Minecraft 服务器并运行它。我现在想要 ftp 访问。目前,有一个用于 world 文件夹的驱动器和用于服务器的 config 文件夹(因为我不能将整个目录放在已安装的驱动器上(对吗?),并且每次重建映像时都需要保存这两个文件夹)。

所以,我希望能够访问 /config。最好在 minecraft 节点仍在读写时。这里有几个问题。

  1. 在为它制作 docker 文件时,如何制作最小的 FTP 图像?我无法弄清楚一个场景。我最好的是 python:alpine 上的基础图像,并使用类似 this 的东西
  2. 是否有可能让节点在另一个驱动器正在使用它时访问它?还是我必须在我制作的界面中制作一些自定义脚本来关闭我的世​​界服务器然后启动 FTP 节点?

当前 yml:

apiVersion: v1
kind: Service
metadata:
  name: lapitos
  labels:
    type: lapitos
spec:
  type: LoadBalancer
  ports:
  - name: minecraft
    port: 25565
    protocol: TCP
    targetPort: 25565
  - name: minecraft-rcon
    port: 25575
    protocol: TCP
    targetPort: 25575
  selector:
    app: lapitos
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: lapitos
spec:
  serviceName: lapitos
  replicas: 1
  selector:
    matchLabels:
      app: lapitos
  template:
    metadata:
      labels:
        app: lapitos
    spec:
      containers:
      - name: lapitos
        image: gcr.io/mchostingnet-202204/lapitosbeta2
        resource:
          limits:
            cpu: "2"
          requests:
            cpu: "2"
        ports:
        - containerPort: 25565
          name: minecraft
        volumeMounts:
        - name: world
          mountPath: /world
        - name: config
          mountPath: /config
        - name: logs
          mountPath: /logs
  volumeClaimTemplates:
  - metadata:
      name: world
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 25Gi
  - metadata:
      name: config
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
  - metadata:
      name: logs
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi

【问题讨论】:

    标签: docker kubernetes google-kubernetes-engine


    【解决方案1】:

    1.- 从任何注册表中获取适合您的 ftp 映像并使用它,而不是自己制作。如果仍然是一个要求,我不知道。 注意:Compute Engine 已阻止端口 21。

    2.- 是的,你可以。卷访问模式:

    • ReadWriteOnce – 卷可以由单个节点以读写方式挂载
    • ReadOnlyMany – 卷可由多个节点以只读方式挂载
    • ReadWriteMany – 卷可以被许多节点以读写方式挂载

    【讨论】:

    • 当尝试使用 ReadWriteMany 时,我遇到了失败,或者 Pod 永远无法制作。
    • 什么故障?从来没有做过?你的意思是他们永远不会运行/启动?
    猜你喜欢
    • 2019-01-21
    • 2017-03-29
    • 2020-05-23
    • 1970-01-01
    • 1970-01-01
    • 2021-05-16
    • 1970-01-01
    • 1970-01-01
    • 2019-05-07
    相关资源
    最近更新 更多