我是OpenWhisk的新手,在设置方面有一些困难。由于Pod中的错误,Ngnix Pod正在CrashLoopBackOff中运行。
2018/07/02 16:14:27 [emerg] 1#1: host not found in resolver "kube-dns.kube-system" in /etc/nginx/nginx.conf:41
nginx: [emerg] host not found in resolver "kube-dns.kube-system" in /etc/nginx/nginx.conf:41我不能跳到Pod本身,但我用Pod使用的相同图像运行了Docker Container,并查看了nginx.conf内部:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}当我查看conf.d目录时,我发现了一个default.conf文件,其中的server_name被设置为本地主机:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}我认为这是导致问题的原因,并且kube.dns服务无法解析本地主机。
然而,我不知道如何解决这个问题,或者至少解决它。也许我可以在Ngnix部署中为Pod设置一个静态主机名,并将该主机名输入到ngnix配置中?
有没有人能给我提供一个变通的方法,或者甚至是一个修复方法?
非常感谢。
发布于 2018-07-03 02:19:55
您是否正在使用“Kubernetes (https://github.com/apache/incubator-openwhisk-deploy-kube)上的OpenWhisk部署”项目?
我怀疑你可能遇到了README.md中描述的Kubernetes bug:
然而,由于卷挂载子路径的错误(参见[1]),Kubernetes的多个次要版本(包括1.8.9和1.9.4 )将不适用于OpenWhisk。在部署nginx容器时,此错误将作为失败浮出水面。
修复此问题的方法是使用没有卷挂载子路径错误的Kubernetes版本。
发布于 2018-07-04 19:58:46
kubeadm从当前运行的主机操作系统会话中获取并检查环境。
您可以通过执行以下命令查看是否设置了proxy:
env | grep _proxy在代理服务器配置为访问internet服务的环境中,例如Docker Hub或Oracle Container Registry,您可能需要执行几个配置步骤才能正确安装和运行Kubernetes。
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/" Environment="HTTPS_PROXY=https://proxy.example.com:443/"
将http://proxy.example.com:80/替换为您的HTTP代理服务的URL。如果您有一个HTTPS代理,并且您也指定了这一点,请将https://proxy.example.com:443/替换为此服务的URL和端口。如果您对Docker systemd服务配置进行了更改,请运行以下命令:
systemctl daemon-reload; systemctl restart docker
export http_proxy="http://proxy.example.com:80/"
export https_proxy="https://proxy.example.com:443/"
export no_proxy="127.0.0.1, 192.0.2.10, 192.0.2.11, 192.0.2.12"
这些步骤应该足以使部署正常工作。使用不需要在主机上进行配置并忽略内部网络请求的透明代理可以降低配置的复杂性,并有助于避免意外行为。
https://stackoverflow.com/questions/51140356
复制相似问题