Kubernetes节点的多驱动器访问

时间:2018-05-14 06:11:12

标签: docker kubernetes google-kubernetes-engine

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

我已经达到了这样的程度,即我的.yml文件需要我的Minecraft服务器并运行它。我现在想要ftp访问。目前,有一个用于world文件夹的驱动器和用于服务器的config文件夹(因为我无法将整个目录放在已安装的驱动器上(对吗?),并且这两个文件夹需要在每次映像时保存重建)。

所以,我希望能够访问/配置。优选地,虽然Minecraft节点仍在读取和写入。这里有几个问题。

  1. 在为其创建docker文件时,如何使最小的FTP图像成为可能?我无法弄清楚一个场景。我最好的是python上的基本图像:alpine并使用this
  2. 之类的东西
  3. 是否可以让节点在另一个节点使用时访问该驱动器?或者我是否必须在接口中制作一些自定义脚本,以关闭Minecraft服务器,然后启动FTP节点?
  4. 当前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
    

1 个答案:

答案 0 :(得分:0)

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

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

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