I need to make available a mysql database hosted in namespace A to an application that is deployed in namespace 'B'.
Thus far, I've tried a few methods, most promising of which was using a combination of Endpoint and service like so:
kind: Service
apiVersion: v1
metadata:
name: mysql
spec:
ports:
- port: 3306
targetPort: 31234
---
kind: Endpoints
apiVersion: v1
metadata:
name: mysql
subsets:
- addresses:
- ip: 12.34.567.8
ports:
- port: 31234
While one instance of a mysql container has already been spinned off in namespace 'A', and exposed at 31234 via NodePort configuration.
The Application has an init container, init-mysql that pings the mysql instance, with host name 'mysql' and correct credentials. I expected the Application to start up as usual, but it was stuck in pod initializing state. When I tried to check the logs of the init-mysql, I got only the following:
Warning: Using a password on the command line interface can be insecure.
The commands that are in use for the initContainer 'init-mysql' are:
command:
- sh
- -c
- 'mysqladmin ping -hmysql -P3306 -uusername -ppassword'