Skip to content

Automatically add service to tunnel data to external database #1

@anbraten

Description

@anbraten

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions