Multidrive access for Kubernetes Nodes

5/14/2018

So, forgive me. I just started learning docker and kubernets a month ago.

I've got this to the point where I have my .yml file that takes my Minecraft server and runs it. I now want ftp access. Currently, there's a drive for the world folder and the config folder for the server (since I can't put the entire directory on a mounted drive (right?) and those two folders need to save every time the image is rebuilt).

So, I want to be able to access /config. Preferably while the minecraft node is still reading and writing. A few questions here.

  1. How do I make the most minimal FTP image possible when making the docker file for it? I am unable to figure out a scenario. Best I have is a base image on python:alpine and to use something like this
  2. Is it even possible to have the node access the drive when it's in use by another? Or do I have to make some custom script in the interface im making that turns off the minecraft server and then starts up the FTP node?

Current 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
-- quantomworks
docker
google-kubernetes-engine
kubernetes

1 Answer

5/21/2018

1.- Grab an ftp image that suits you from any registry and use it, instead of making your own. If still is a requirement, I don't know. Note: Compute Engine has got port 21 blocked.

2.- Yes, you can. Volume access modes:

  • ReadWriteOnce – the volume can be mounted as read-write by a single node
  • ReadOnlyMany – the volume can be mounted read-only by many nodes
  • ReadWriteMany – the volume can be mounted as read-write by many nodes
-- suren
Source: StackOverflow