Skip to content

Commit

Permalink
Bug 1293578 - The Router liveness/readiness probes should always use …
Browse files Browse the repository at this point in the history
…localhost

Pods using the hostNetwork are getting the default IP from the Node entry for
their liveness probe today.  In some common misconfigurations this IP will not
actually be physically present on the Node running the probes and therefore
will not be short-circuited to use the loopback interface.  In those cases the
probes will fail unless an admin manually opens up port that allows the probe
to pass.

We're putting checks in place for this situation but this seems like a
reasonable safeguard to make sure a critical piece of infrastructure comes up
the first time.
  • Loading branch information
brenton committed Feb 1, 2016
1 parent 920ad9a commit 9e34a1c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/cmd/admin/router/router.go
Expand Up @@ -344,6 +344,13 @@ func generateProbeConfigForRouter(cfg *RouterConfig, ports []kapi.ContainerPort)
IntVal: int32(healthzPort),
},
}

// Workaround for misconfigured environments where the Node's InternalIP is
// physically present on the Node. In those environments the probes will

This comment has been minimized.

Copy link
@akostadinov

akostadinov Feb 2, 2016

Contributor

physically present or not present?

How would this work if node executing probe is not running the router? Or will they always be the same?

// fail unless a host firewall port is opened
if cfg.HostNetwork {
probe.Handler.HTTPGet.Host = "localhost"
}
}

return probe
Expand Down
4 changes: 4 additions & 0 deletions test/cmd/admin.sh
Expand Up @@ -209,6 +209,10 @@ os::cmd::expect_success_and_text "oadm router -o yaml --credentials=${KUBECONFIG
os::cmd::expect_success "oadm router --credentials=${KUBECONFIG} --images='${USE_IMAGES}' --service-account=router -n default"
os::cmd::expect_success_and_text 'oadm router -n default' 'service exists'
os::cmd::expect_success_and_text 'oc get dc/router -o yaml -n default' 'readinessProbe'
os::cmd::expect_success_and_text 'oc get dc/router -o yaml -n default' 'host: localhost'

# only when using hostnetwork should we force the probes to use localhost
os::cmd::expect_success_and_not_text "oadm router -o yaml --credentials=${KUBECONFIG} --service-account=router -n default --host-network=false" 'host: localhost'
echo "router: ok"

# Test running a registry
Expand Down

0 comments on commit 9e34a1c

Please sign in to comment.