If it is within the same namespace, name resolution can be done using the metadata.name
of the Service.
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: airflow
spec:
ports:
- name: "6379"
port: 6379
targetPort: 6379
With this configuration, you can resolve the name redis
from other Pods.
redis://:@redis:6379/0
Similarly,
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: airflow
spec:
ports:
- name: "5432"
port: 5432
targetPort: 5432
With this setup, you can resolve the name postgres
as follows:
db+postgresql://username:password@postgres/airflow
postgresql+psycopg2://username:password@postgres/airflow
Comments