HostAlias ​​игнорируется в POD оператора AWX

HostAlias ​​игнорируется в POD оператора AWX

Недавно мне пришлось переместить свой кластер K3, работающий под управлением AWX-operator. IP-адреса моих узлов пришлось изменить с 10.0.3.51, 10.0.3.52, 10.0.3.53 на 10.6.3.44, 10.6.3.45, 10.6.3.71. Я обновил hostAlias ​​в своем развертывании awx-demo:

271       dnsPolicy: ClusterFirst
272       hostAliases:
273       - hostnames:
274         - awx.example.com
275         ip: 10.6.3.44
276       initContainers:
277       - command:
278         - /bin/sh
279         - -c
280         - |
281           hostname=$MY_POD_NAME
282           receptor --cert-makereq bits=2048 commonname=$hostname dnsname=$hostname nodeid=$hostname outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key
283           receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/receptor-ca.crt cakey=/etc/receptor/tls/ca/receptor-ca.key outcert=/etc/receptor/tls/    receptor.crt verify=yes

Но все еще на моих подах automation-job файл /etc/hosts имеет старый IP-адрес. Что я могу сделать, чтобы исправить /etc/hosts, когда мои поды automation-job будут созданы?

Я могу зайти в модуль автоматизации вот так и показать /etc/hosts

$ kubectl -n awx exec -it automation-job-19120-2npln -- bash
bash-4.4$ cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.42.1.31  automation-job-19120-2npln

# Entries added by HostAliases.
10.0.3.51   awx.example.com
bash-4.4$

Если я редактирую модуль, то вижу это...

apiVersion: v1
kind: Pod
metadata:
  ... omitted ...
spec:
  automountServiceAccountToken: false
  containers:
  - args:
    - ansible-runner
    - worker
    - --private-data-dir=/runner
    image: quay.io/ansible/awx-ee:latest
    imagePullPolicy: Always
    name: worker
    resources:
      requests:
        cpu: 250m
        memory: 100Mi
    stdin: true
    stdinOnce: true
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  hostAliases:
  - hostnames:
    - awx.example.com
    ip: 10.0.3.51
  nodeName: rocky-k3-3
  ... omitted ...

Откуда, черт возьми, взялся этот 10.0.3.51?

решение1

Кто-то из рассылки AWX напомнил мне, что мне нужно использовать консоль AWX Web UI для обновления Admininstation >> Group Instance >> 'default' и обновить определенные hostAliasesтам. Из документации:https://docs.ansible.com/automation-controller/latest/html/administration/containers_instance_groups.html#customize-the-pod-spec

Связанный контент