Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1594958

Summary: Egress router dns pod keep restarting
Product: OpenShift Container Platform Reporter: Weibin Liang <weliang>
Component: NetworkingAssignee: Ravi Sankar <rpenta>
Networking sub component: router QA Contact: zhaozhanqi <zzhao>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: aos-bugs, bbennett, bmeng, rpenta, xtian
Version: 3.10.0   
Target Milestone: ---   
Target Release: 3.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: DNS IP on the pod is explicitly set other than the node IP and that IP is not routable. Consequence: egress dns-proxy fails as haproxy fails to resolve dns requests for the domain. Fix: Add a route to DNS IP via SDN Result: DNS requests works in the pod and egress dns-proxy will have no issues while starting.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-20 21:38:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Weibin Liang 2018-06-25 20:12:52 UTC
Description of problem:
In docker-in-dokcer testing env, deploy an egress router dns pod, it keep restarting and can not stay in stable  running state.

Version-Release number of selected component (if applicable):
v3.10.0-0.69.0+390ae78-1

How reproducible:
Every time.

Steps to Reproduce:
[root@openshift-master /]# cat egress-dns-pod.yaml 
apiVersion: v1
kind: Pod
metadata:
  name: egress-dns-pod
  labels:
    name: egress-dns-pod
  annotations:
    pod.network.openshift.io/assign-macvlan: "true"
spec:
  initContainers:
  - name: egress-router-setup
    image: registry.reg-aws.openshift.com:443/openshift3/ose-egress-router:v3.10.0-0.69.0
    imagePullPolicy:  IfNotPresent
    securityContext:
      privileged: true
    env:
    - name: EGRESS_SOURCE
      value: 172.17.0.222
    - name: EGRESS_GATEWAY
      value: 172.17.0.1
    - name: EGRESS_ROUTER_MODE
      value: dns-proxy
  containers:
  - name: egress-dns-proxy
    image: registry.reg-aws.openshift.com:443/openshift3/ose-egress-dns-proxy:v3.10.0-0.69.0
    imagePullPolicy:  IfNotPresent
    env:
    - name: EGRESS_DNS_PROXY_DEBUG
      value: "1"
    - name: EGRESS_DNS_PROXY_DESTINATION
      value: |
        80     www.baidu.com
        443   74.125.68.106
[root@openshift-master /]# oc create -f egress-dns-pod.yaml 
pod "egress-dns-pod" created
[root@openshift-master /]# oc get pod
NAME                   READY     STATUS    RESTARTS   AGE
egress-dns-pod         0/1       Error     2          2m
egress-redirect-pod    1/1       Unknown   0          4h
egress-redirect-pod1   1/1       Running   0          3h
hello-pod              1/1       Running   0          3h
[root@openshift-master /]# oc log egress-dns-pod
log is DEPRECATED and will be removed in a future version. Use logs instead.
Running haproxy with config:
  
  global
      log         127.0.0.1 local2
  
      chroot      /var/lib/haproxy
      pidfile     /var/lib/haproxy/run/haproxy.pid
      maxconn     4000
      user        haproxy
      group       haproxy
  
  defaults
      log                     global
      mode                    tcp
      option                  dontlognull
      option                  tcplog
      option                  redispatch
      retries                 3
      timeout http-request    100s
      timeout queue           1m
      timeout connect         10s
      timeout client          1m
      timeout server          1m
      timeout http-keep-alive 100s
      timeout check           10s
  
  resolvers dns-resolver
      nameserver ns1 172.30.0.1:53
      resolve_retries      3
      timeout retry        1s
      hold valid           10s
  
  
  frontend fe1
      bind :80
      default_backend be1
  
  backend be1
      server dest1 www.baidu.com:80 check resolvers dns-resolver resolve-prefer ipv4
  
  frontend fe2
      bind :443
      default_backend be2
  
  backend be2
      server dest2 74.125.68.106:443 check 
  
[ALERT] 175/194553 (1) : parsing [/etc/haproxy/haproxy.cfg:38] : 'server dest1' : could not resolve address 'www.baidu.com'.
[ALERT] 175/194553 (1) : Failed to initialize server(s) addr.

[root@openshift-master /]# oc get pod
NAME                   READY     STATUS             RESTARTS   AGE
egress-dns-pod         0/1       CrashLoopBackOff   2          2m
egress-redirect-pod    1/1       Unknown            0          4h
egress-redirect-pod1   1/1       Running            0          3h
hello-pod              1/1       Running            0          3h
[root@openshift-master /]# oc log egress-dns-pod
log is DEPRECATED and will be removed in a future version. Use logs instead.
Running haproxy with config:
  
  global
      log         127.0.0.1 local2
  
      chroot      /var/lib/haproxy
      pidfile     /var/lib/haproxy/run/haproxy.pid
      maxconn     4000
      user        haproxy
      group       haproxy
  
  defaults
      log                     global
      mode                    tcp
      option                  dontlognull
      option                  tcplog
      option                  redispatch
      retries                 3
      timeout http-request    100s
      timeout queue           1m
      timeout connect         10s
      timeout client          1m
      timeout server          1m
      timeout http-keep-alive 100s
      timeout check           10s
  
  resolvers dns-resolver
      nameserver ns1 172.30.0.1:53
      resolve_retries      3
      timeout retry        1s
      hold valid           10s
  
  
  frontend fe1
      bind :80
      default_backend be1
  
  backend be1
      server dest1 www.baidu.com:80 check resolvers dns-resolver resolve-prefer ipv4
  
  
  frontend fe2
      bind :443
      default_backend be2
  
  backend be2
      server dest2 74.125.68.106:443 check 
  
[ALERT] 175/194553 (1) : parsing [/etc/haproxy/haproxy.cfg:38] : 'server dest1' : could not resolve address 'www.baidu.com'.
[ALERT] 175/194553 (1) : Failed to initialize server(s) addr.
[root@openshift-master /]# oc get pod
NAME                   READY     STATUS    RESTARTS   AGE
egress-dns-pod         1/1       Running   3          2m
egress-redirect-pod    1/1       Unknown   0          4h
egress-redirect-pod1   1/1       Running   0          3h
hello-pod              1/1       Running   0          3h
[root@openshift-master /]# oc log egress-dns-pod
log is DEPRECATED and will be removed in a future version. Use logs instead.
Running haproxy with config:
  
  global
      log         127.0.0.1 local2
  
      chroot      /var/lib/haproxy
      pidfile     /var/lib/haproxy/run/haproxy.pid
      maxconn     4000
      user        haproxy
      group       haproxy
  
  defaults
      log                     global
      mode                    tcp
      option                  dontlognull
      option                  tcplog
      option                  redispatch
      retries                 3
      timeout http-request    100s
      timeout queue           1m
      timeout connect         10s
      timeout client          1m
      timeout server          1m
      timeout http-keep-alive 100s
      timeout check           10s
  
  resolvers dns-resolver
      nameserver ns1 172.30.0.1:53
      resolve_retries      3
      timeout retry        1s
      hold valid           10s
  
  
  frontend fe1
      bind :80
      default_backend be1
  
  backend be1
      server dest1 www.baidu.com:80 check resolvers dns-resolver resolve-prefer ipv4
   
  frontend fe2
      bind :443
      default_backend be2
  
  backend be2
      server dest2 74.125.68.106:443 check 
  
[root@openshift-master /]# 

Actual results:
egress-dns-pod keep restarting

Expected results:
egress-dns-pod should be in stable running state.

Additional info:
Ravips spend some time on debugging this failure and found out in dind case, /etc/resolv.conf has cluster service IP instead of node IP to make it work with OVN so this needs to be fixed.

Same issue exists with egress http proxy mode as well

Comment 1 Ravi Sankar 2018-06-25 20:56:12 UTC
https://github.com/openshift/origin/pull/20094

Comment 2 Ravi Sankar 2018-06-25 20:56:13 UTC
https://github.com/openshift/origin/pull/20094

Comment 3 Ben Bennett 2018-06-26 18:01:24 UTC
Here's the port to 3.10 -- https://github.com/openshift/origin/pull/20102

Comment 5 Weibin Liang 2018-06-27 14:07:00 UTC
@bmeng, tried same test case in AWS and Openstack env, both env will block the
the traffic with EGRESS_SOURCE defined in YAML file, only dind env will NAT the traffic with EGRESS_SOURCE, and egress router test case can pass in dind env

Comment 8 Weibin Liang 2018-06-28 18:20:14 UTC
Tested in dind env with v3.10.0-rc.0+9453255-21, egress-dns-pod is running without any continue restarting issue.