Set ClusterFirstWithHostNet for Pods with hostnetwork: true

In kubernetes 1.6 ClusterFirstWithHostNet was added as an option. In
accordance to it kubelet will generate resolv.conf based on own
resolv.conf. However, this doesn't create 'options', thus the proper
solution requires some investigation.

This patch sets the same resolv.conf for kubelet as host

Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
pull/1186/head
Sergii Golovatiuk 2017-03-28 16:33:07 +02:00
parent fac4334950
commit 1cfe0beac0
6 changed files with 14 additions and 1 deletions

View File

@ -4,7 +4,7 @@
dest: "{{kube_config_dir}}/{{item.file}}"
with_items:
- {file: netchecker-agent-ds.yml, type: ds, name: netchecker-agent}
- {file: netchecker-agent-hostnet-ds.yml, type: ds, name: netchecker-agent-hostnet}
- {file: netchecker-agent-hostnet-ds.j2, type: ds, name: netchecker-agent-hostnet}
- {file: netchecker-server-pod.yml, type: po, name: netchecker-server}
- {file: netchecker-server-svc.yml, type: svc, name: netchecker-service}
register: manifests

View File

@ -13,6 +13,9 @@ spec:
app: netchecker-agent-hostnet
spec:
hostNetwork: True
{%- if kube_version | version_compare('v1.6', '>=') -%}
dnsPolicy: ClusterFirstWithHostNet
{%- endif -%}
containers:
- name: netchecker-agent
image: "{{ agent_img }}"

View File

@ -8,6 +8,9 @@ metadata:
kargo: v2
spec:
hostNetwork: true
{% if kube_version | version_compare('v1.6', '>=') %}
dnsPolicy: ClusterFirstWithHostNet
{% endif %}
containers:
- name: kube-apiserver
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}

View File

@ -7,6 +7,9 @@ metadata:
k8s-app: kube-controller
spec:
hostNetwork: true
{%- if kube_version | version_compare('v1.6', '>=') -%}
dnsPolicy: ClusterFirstWithHostNet
{%- endif -%}
containers:
- name: kube-controller-manager
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}

View File

@ -7,6 +7,9 @@ metadata:
k8s-app: kube-scheduler
spec:
hostNetwork: true
{%- if kube_version | version_compare('v1.6', '>=') -%}
dnsPolicy: ClusterFirstWithHostNet
{%- endif -%}
containers:
- name: kube-scheduler
image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}

View File

@ -11,6 +11,7 @@
-v /etc/cni:/etc/cni:ro \
-v /opt/cni:/opt/cni:ro \
-v /etc/ssl:/etc/ssl:ro \
-v /etc/resolv.conf:/etc/resolv.conf \
{% for dir in ssl_ca_dirs -%}
-v {{ dir }}:{{ dir }}:ro \
{% endfor -%}