I
I
Ivan Vekov2021-01-20 16:40:44
linux
Ivan Vekov, 2021-01-20 16:40:44

How to mount in minikube with virtualization?

Good afternoon,

I have a server (VPS on Ubuntu 18), minikube is installed on it with driver = kvm2, and there is a deploy:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-php-app
spec:
  replicas: 1
  selector:
     matchLabels:
        app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      volumes:
        # Create the shared files volume to be used in both pods
        - name: app-files
          hostPath:
            path: /opt/hw2/app
            type: Directory
        - name: nginx-config-volume
          configMap:
            name: nginx-config
      containers:
        - name: backend
          image: nginx
          imagePullPolicy: Never
          ports:
            - containerPort: 80
          volumeMounts:
            - name: app-files
              mountPath: /var/www/html
            - name: nginx-config-volume
              mountPath: /etc/nginx/nginx.conf
              subPath: nginx.conf
          env:
            - name: DB_HOST
              value: my-app-mysql
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: password
        - name: php-fpm
          image: ivekov/php-fpm
          imagePullPolicy: Never
          volumeMounts:
            - name: app-files
              mountPath: /var/www/html


And now the mount does not work from the word at all. I suspect (but this is not certain) that the problem is that hostPath - I specify the path to the files on the VPS itself (/opt/hw2/app), and when installing the application, it considers that the host is kvm2. This is a theory, I could not find confirmation of my idea. Just when you start without a driver (--driver=none) - everything works fine.

Actually the question is - did I understand the problem correctly, and how to solve it? Do I need to put app-files inside kvm? It doesn't seem right somehow.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question