[英]Kubernetes Elasticsearch centos - unable to start nginx in the pod
我在 kubernetes 中使用 elasticsearch。 我希望使用 nginx 添加另一層保護。
當我嘗試使用systemctl start nginx
運行 nginx systemctl start nginx
我得到:
Failed to get D-Bus connection: Operation not permitted
這似乎是centos
一個已知問題,因為它的 docker 發行版沒有完整的systemd
。
遵循centos指南對我不起作用:
https://hub.docker.com/_/centos請參閱Dockerfile for systemd base image
部分
我的嘗試
Docker 文件 -
FROM docker.elastic.co/elasticsearch/elasticsearch:7.6.1
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
# Install gcs plugin
RUN bin/elasticsearch-plugin install --batch repository-gcs
# install nginx
RUN yum install -y epel-release
RUN yum install -y nginx
# Copy configuration
COPY my-config.conf /etc/nginx/sites-enabled/my-config.conf
CMD ["/usr/sbin/init"]
還嘗試在 kubernetes yaml 中添加 docker 參數 -
args:
["--tmpfs", "/run", "-v", "/sys/fs/cgroup:/sys/fs/cgroup:ro"]
或者
["-ti", "-v", "/sys/fs/cgroup:/sys/fs/cgroup:ro", "-v", "/tmp/$(mktemp -d):/run"]
這些都沒有幫助。
看到這個問題,但沒有很多答案似乎工作,例如: https://serverfault.com/questions/824975/failed-to-get-d-bus-connection-operation-not-permitted https://開頭github上。 com/CentOS/sig-cloud-instance-images/issues/45#issuecomment-363709254
出於安全原因,不推薦使用特權 docker 容器,所以我寧願不使用它。
我怎樣才能使這項工作?
容器是為運行單個應用程序而構建的。 您應該為 nginx 代理使用一個單獨的代理,而為 Elasticsearch 使用另一個。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.