Skip to main content

Create an endpoint in kubernetes to connect to an external service - mariadb

· One min read
Hreniuc Cristian-Alexandru

Check this

This is an example of how to connect an internal pod to an external db that is not inside the cluster. In the pod configuration you will need to connect to the brandName-database service from below.

apiVersion: v1
kind: Service
metadata:
name: brandName-database
spec:
ports:
- name: brandName-database-external
protocol: TCP
port: 3306
targetPort: 3306

---
kind: Endpoints
apiVersion: v1
metadata:
name: brandName-database
subsets:
- addresses:
- ip: 192.168.100.52
ports:
- port: 3306
name: brandName-database-external