3

我正在尝试使用 hydra 部署登录同意提供程序。

这是yaml文件。

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: login-consent-deployment
  labels:
    app: login-consent-nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: login-consent-nginx
  template:
    metadata:
      labels:
        app: login-consent-nginx
    spec:
      containers:
      - name: login-consent-nginx
        image: ubergarm/openresty-nginx-jwt:latest
        command: ["/usr/local/openresty/bin/openresty", "-g", "daemon off;", "-c", "/usr/local/openresty/nginx/conf/nginx.conf"]
        ports:
        - name: http-lc-port
          containerPort: 80
        resources:
          limits:
            cpu: "0.1"
            memory: 32Mi
        volumeMounts:
        - mountPath: /etc/nginx/conf.d
          name: login-consent-nginx-conf-volume
        - mountPath: /usr/local/openresty/nginx/html
          name: login-consent-www-resources
      volumes:
      - name: login-consent-nginx-conf-volume
        configMap:
          name: login-consent-conf
          items:
            - key: login-consent.conf
              path: login-consent.conf
      - name: login-consent-www-resources
        hostPath:
          path: C:\Users\myUser\www
          type: Directory

---
apiVersion: v1
kind: Service
metadata:
  name: login-consent-service
spec:
  type: LoadBalancer
  selector:
    app: login-consent-nginx
  ports:
  - protocol: TCP
    name: http-lc-nginx
    port: 3000
    targetPort: http-lc-port

部署后我在 pod 描述中遇到的错误

Warning  FailedMount            2s (x4 over 6s)  kubelet, docker-for-desktop  MountVolume.SetUp failed for volume "login-consent-www-resources" : hostPath type check failed: C:\Users\myUser\www is not a directory

www是我的用户主目录中的一个文件夹

$docker run --rm -v c:/Users/myUser:/data alpine ls /data
3D Objects
...
...
...
...
www

我想知道我在这里做错了什么?我正在使用 docker for windows 和它自己的集成 Kubernetes,并且我在 dockers 中启用了我的共享文件夹 C。

有什么帮助吗?

4

2 回答 2

2

因此,在 docker 容器中,您c:/Users/myUser现在可以作为/data. 因此,您必须/data/www用作主机路径。

于 2019-07-06T06:33:06.430 回答
0

Windows 风格的路径对我不起作用,直到我将其更改为 Unix 风格,如下所示:

path: /C/Users/myUser/www
于 2022-02-26T01:36:59.270 回答