Я пытаюсь использовать обратный прокси-сервер nginx и использовать простой default.conf.Вот мой файл docker-compose:
version: '3'
services:
authorizationmicroservice:
image: gcr.io/root-booking-245613/authorizationmicroservice:v1
container_name: authorizationmicroservice
restart: always
labels:
- "kompose.service.type=LoadBalancer"
ports:
- "3002:${PORT:-3002}"
networks:
- backend
musicmicroservice:
image: gcr.io/root-booking-245613/musicmicroservice:v1
container_name: musicmicroservice
restart: always
ports:
- "3001:${PORT:-3001}"
networks:
- backend
labels:
- "kompose.service.type=LoadBalancer"
nginx:
image: nginx:latest
networks:
- backend
ports:
- "8080:${PORT:-8080}"
volumes:
- ./nginxProxy:/etc/nginx/conf.d
depends_on:
- authorizationmicroservice
- musicmicroservice
labels:
- "kompose.service.type=LoadBalancer"
networks:
backend:
Все работает нормально, если я создаю docker-compose, но когда я пытаюсь развернуть его с помощью kubernetes, я получаю следующий журнал ошибок в модуле nginx:
Warning Failed
34m
kubelet, gke-hello-cluster-default-pool-8c57f061-7hd8
Error: failed to start container "nginx": Error response from daemon:
OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/home/artemda4/kubernetes-engine-samples/muniverse/home/artemda4/kubernetes-engine-samples/muniverse/nginxProxy/default.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/751acda10027acdcca21d16df3be48197170c04dd3520cd7fa8aeb083b5b6bc1/merged\\\" at \\\"/var/lib/docker/overlay2/751acda10027acdcca21d16df3be48197170c04dd3520cd7fa8aeb083b5b6bc1/merged/etc/nginx/conf.d/default.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Как мне подключать тома в Kubernetes?Это мой конфиг nginx, он находится в nginxProxy
server {
listen 8080;
client_max_body_size 50m;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
root /srv/www/static;
location /api/authorization {
proxy_pass http://authorizationmicroservice:3002;
}
location /api/music {
proxy_pass http://musicmicroservice:3001;
}
location /api/playlist {
proxy_pass http://musicmicroservice:3001;
}
#this where socket io will be handling the request
location /socket.io {
proxy_pass http://musicmicroservice:3001/socket.io/;
}
}