Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically add service to tunnel data to external database #1

Open
anbraten opened this issue Feb 2, 2021 · 0 comments
Open

Automatically add service to tunnel data to external database #1

anbraten opened this issue Feb 2, 2021 · 0 comments

Comments

@anbraten
Copy link
Owner

anbraten commented Feb 2, 2021

The created service name should be configurable by some setting like serviceName in the database CRD. Leaving that settings empty / out should prevent the controller from creating a service. The serive should be deployed to the same namespace the database CRD is saved to.

Service creation

Looks like there are two ways:

  1. Service with IP-Address
kind: Service
apiVersion: v1
metadata:
 name: mongo
Spec:
 type: ClusterIP
 ports:
 - port: 27017
   targetPort: 27017
kind: Endpoints
apiVersion: v1
metadata:
 name: mongo # has to be the same name use by the service
subsets:
 - addresses:
     - ip: 10.240.0.4 # ip of the cluster-external mongo database
   ports:
     - port: 27017
  1. Service with type ExternalName (DNS hostname)
kind: Service
apiVersion: v1
metadata:
 name: mongo
spec:
 type: ExternalName
 externalName: db123.my-favourite-provider.tld

SOURCE: https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-mapping-external-services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant