Sign inSign up

vikas027/k8s_watch

By vikas027

•Updated about 7 years ago

Kubernetes Watch Events

Image
0

91

vikas027/k8s_watch repository overview

⁠k8s-watch

A repository to watch Kubernetes events and create an 'A' record on PowerDNS server by making an API call

⁠Flow

Watch Ingress API (through a pod in K8S) -> Push a message to RabbitMQ Server when an Ingress is created -> Pika (a RabbitMQ Python client) will watch the queue and create a record by making a API call to PowerDNS

⁠TO-DO

  • Use livenessProbe command⁠ to check python process (then I would not need to do troubleshoot this)
  • Sometimes the stream fails with below error, need to fix this.
➜  ~ # kubectl -n kube-system logs -f powerdns-create-record-6d4dffcdcf-bfkkn
2019-08-24 06:37:55,563 - k8s_events - INFO - Event: ADDED Ingress site-counter-deployment
2019-08-24 06:37:55,572 - k8s_events - INFO - prometheus.cli-api.fun,ADDED
2019-08-24 06:37:55,576 - k8s_events - INFO - grafana.cli-api.fun,ADDED
2019-08-24 06:40:37,109 - k8s_events - INFO - Event: DELETED Ingress site-counter-deployment
2019-08-24 06:40:37,109 - k8s_events - INFO - prometheus.cli-api.fun,DELETED
Task exception was never retrieved
future: <Task finished coro=<ingresses() done, defined at /usr/local/bin/watch_ingress.py:56> exception=StreamLostError: ("Stream connection lost: ConnectionResetError(104, 'Connection reset by peer')",)>
Traceback (most recent call last):
  File "/usr/local/bin/watch_ingress.py", line 72, in ingresses
    create_dns(item[k], event['type'])
  File "/usr/local/bin/watch_ingress.py", line 53, in create_dns
    body=msg)
  File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 2248, in basic_publish
    self._flush_output()
  File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 1336, in _flush_output
    self._connection._flush_output(lambda: self.is_closed, *waiters)
  File "/usr/local/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 522, in _flush_output
    raise self._closed_result.value.error
pika.exceptions.StreamLostError: Stream connection lost: ConnectionResetError(104, 'Connection reset by peer')

Tag summary

Content type

Image

Digest

Size

102.6 MB

Last updated

about 7 years ago

docker pull vikas027/k8s_watch:powerdns