Airflow k8s operator xcom - состояние рукопожатия 403 запрещено

Когда я запускаю образ докеры с помощью KubernetesPodOperator в Airflow версии 1.10

После того, как модуль успешно завершает задачу, воздушный поток пытается получить значение xcom, установив соединение с модулем через клиент потока k8s.

Ниже приводится ошибка, с которой я столкнулся:

[2018-12-18 05:29:02,209] {{models.py:1760}} ERROR - (0)
Reason: Handshake status 403 Forbidden
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/kubernetes/stream/ws_client.py", line 249, in websocket_call
    client = WSClient(configuration, get_websocket_url(url), headers)
  File "/usr/local/lib/python3.6/site-packages/kubernetes/stream/ws_client.py", line 72, in __init__
    self.sock.connect(url, header=header)
  File "/usr/local/lib/python3.6/site-packages/websocket/_core.py", line 223, in connect
    self.handshake_response = handshake(self.sock, *addrs, **options)
  File "/usr/local/lib/python3.6/site-packages/websocket/_handshake.py", line 79, in handshake
    status, resp = _get_resp_headers(sock)
  File "/usr/local/lib/python3.6/site-packages/websocket/_handshake.py", line 152, in _get_resp_headers
    raise WebSocketBadStatusException("Handshake status %d %s", status, status_message)
websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden

Я использую для этого сервисный аккаунт K8s

Конфиги DAG

xcom = истина,

get_logs = Верно,

in_cluster = истина


person Deep Nirmal    schedule 18.12.2018    source источник
comment
Привет, у нас возникла та же проблема. Вы нашли решение?   -  person Yoav Gaudin    schedule 30.01.2019


Ответы (1)


Таким образом, мы также столкнулись с этой проблемой, нам пришлось изменить наши правила rbac, в частности, нам пришлось добавить ресурс «pods / exec» с помощью глаголов «создать» и «получить».

---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: airflow-runner
rules:
- apiGroups: [""]
  resources: ["deployments", "pods", "pods/log", "pods/exec", "persistentvolumeclaims"]
  verbs: ["*"]
- apiGroups: [""]
  resources: ["secrets"]
  resourceNames: ["singleuser-image-credentials"]
  verbs: ["read","list","watch","create","get"]
person Timothy Griffiths    schedule 07.03.2019
comment
Вы также создали ServiceAccount и ClusterRoleBinding? - person alltej; 23.02.2020