Nginx OpenWhisk Ngnix吊舱碰撞回撤

Nginx OpenWhisk Ngnix吊舱碰撞回撤,nginx,kubernetes,containers,openwhisk,Nginx,Kubernetes,Containers,Openwhisk,我是OpenWhisk的新手,在设置上有一些困难。 由于Pod中的错误,Ngnix Pod正在崩溃回退中运行 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

我是OpenWhisk的新手,在设置上有一些困难。 由于Pod中的错误,Ngnix Pod正在崩溃回退中运行

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本身,但我运行了一个Docker容器,该容器使用的图像与Pod使用的图像相同,并在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文件,其中服务器名称设置为localhost:

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服务无法解析localhost

然而,我不知道如何解决这个问题,或者至少解决它。 也许我可以在Ngnix部署中为Pod设置一个静态主机名,并将该主机名输入Ngnix配置

有没有人能为我提供一个解决方案,甚至是一个修复方案

非常感谢。

您正在使用“Kubernetes()项目上的OpenWhisk部署”吗

我怀疑您可能遇到了以下文件中描述的Kubernetes错误:

但是,由于卷装入子路径(请参见[])存在错误,Kubernetes的多个次要版本(包括1.8.9和1.9.4)将不适用于OpenWhisk。在部署nginx容器时,此错误将作为故障出现


修复方法是使用一个没有卷装入子路径错误的Kubernetes版本。

kubeadm从当前运行的主机操作系统会话获取并检查环境

您可以通过执行以下命令检查是否已设置代理:

env | grep _proxy
在代理服务器配置为访问internet服务的环境中,如Docker Hub或Oracle容器注册表,您可能需要执行多个配置步骤,以使Kubernetes安装并正确运行

  • 确保群集中每个节点上的Docker引擎启动配置都配置为使用代理服务器。例如,在/etc/systemd/system/Docker.service.d/http-proxy.conf处创建一个systemd service插件文件,其中包含以下内容:

    [服务]

    Environment=“HTTP\u代理=http://proxy.example.com:80/“
    Environment=“HTTPS\u代理=https://proxy.example.com:443/“

    替换为HTTP代理服务的URL。如果您有HTTPS代理并且也指定了此代理,请替换为此服务的URL和端口。如果您已更改Docker systemd服务配置,请运行以下命令:

    systemctl守护进程重新加载;systemctl重新启动docker

  • 您可能需要设置http_proxy或https_proxy环境变量,以便能够在群集中的任何节点上运行其他命令。例如:

    导出http\u代理=”http://proxy.example.com:80/“

    导出https\u代理=”https://proxy.example.com:443/“

  • 禁用本地主机和群集中任何节点IP的代理配置:

    export no_proxy=“127.0.0.1、192.0.2.10、192.0.2.11、192.0.2.12”


这些步骤应足以使部署正常运行。使用不需要在主机上配置且忽略内部网络请求的透明代理,可以降低配置的复杂性,并可能有助于避免意外行为。

您好,我使用的是Kubernetes 1.10版,这是错误吗在那里发生之前?这个错误似乎应该在1.10中修复。我将尝试降级到Kubernetes 1.8,并报告它是否有效。因此,我不需要降级到Kubernetes 1.8。这个错误不是问题,问题是我在Kubernetes中使用了自定义群集dns。似乎有些组件(调用程序、卡夫卡、控制器)不会从kubelet dns参数或w/e提取自定义配置。可能需要检查。知道我只需要知道如何配置docker pull runtimes init容器(在调用器吊舱内(每个节点1个))以使用代理,因为我在公司代理后面。@rootdoot“docker pull runtimes init容器以使用代理“-你是什么意思?据我所知,您的Kubernetes可以提取图像,因为您运行应用程序。因为我的集群位于公司浏览器后面,所以我需要一种方法来告诉容器使用代理。当然,如果我理解正确的话。