Skip to content

OCP install fails: use_etc_hosts silently defaults to true, writes 127.0.0.1 to /etc/hosts #191

@abix-

Description

@abix-

Bug

Installing Ascender on OCP (k8s_platform: ocp) fails at the "Wait until Ascender API is Up" task with:

Status code was -1 and not [200]: Request failed: <urlopen error [Errno 111] Connection refused>

The installer's uri check hits 127.0.0.1 instead of the actual OCP ingress VIP because /etc/hosts was modified by the installer itself.

Root Cause

Two issues combine to cause this:

1. config_vars.sh never prompts for use_etc_hosts on OCP

The prompt is gated to k3s/dkp/rke2 only:

if [[ ( $k8s_platform == "k3s" || $k8s_platform == "dkp" || $k8s_platform == "rke2") ]]; then

OCP is not included, so use_etc_hosts is never written to custom.config.yml.

2. default.config.yml defaults use_etc_hosts: true

Since the variable is absent from custom.config.yml, it falls through to the default:

use_etc_hosts: true

3. k8s_setup_ocp.yml honors use_etc_hosts and writes localhost entries

The OCP setup task file has the same /etc/hosts tasks as the k3s setup, writing entries like:

127.0.0.1   ascender.example.com
127.0.0.1   ledger.example.com

This maps the Ascender hostname to localhost on the installer host. The final health check then curls localhost on port 443, gets connection refused, retries 200 times, and fails.

Impact

Every OCP install using the default config will hit this. The app deploys fine (pods running, route admitted, migration complete), but the installer reports failure. Users will waste time debugging networking and firewall issues when the real problem is a bad /etc/hosts entry the installer wrote.

Suggested Fix

Option A (preferred): Remove the /etc/hosts tasks from k8s_setup_ocp.yml entirely. OCP uses Routes with external DNS, so local host file entries are never appropriate.

Option B: Add ocp to the platform guard in config_vars.sh so the user is at least prompted, and default it to false for OCP.

Option C (minimal): Add a when: k8s_platform not in ["ocp", "aks", "gke", "eks"] condition to the /etc/hosts tasks so they only run on platforms where local resolution makes sense (k3s, rke2, dkp).

Environment

  • Ascender 25.3.5
  • AWX Operator 2.19.4
  • OKD 4.17.0-okd-scos.0
  • Installer host: RHEL 9

Workaround

Add use_etc_hosts: false to custom.config.yml before running setup.sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions