From preview environment I want to access a database located in staging environment (in namespace jx-staging
).
I am trying to follow Service Linking from Jenkins-X documentation with no success. Documentation is not really clear where to put the service link definition.
I created a service file charts/preview/resources/mysql.yaml
with following content, but the service link is not created.
kind: Service
apiVersion: v1
metadata:
name: mysql
spec:
type: ExternalName
externalName: mysql.jx-staging.svc.cluster.local
ports:
- port: 3306
JX Environment:
jx version:
NAME VERSION
jx 1.3.688
jenkins x platform 0.0.3125
Kubernetes cluster v1.10.9-gke.5
kubectl v1.10.7
helm client v2.12.1+g02a47c7
helm server v2.12.0+gd325d2a
git git version 2.11.0
Operating System Debian GNU/Linux 9.6 (stretch)
Where and how to define a service link?
GitHub issue: How to link external service in preview environment
BTW there is also a FAQ entry on adding more resources to a preview.
Your Service
YAML looks good to me. Do you see the Service
created when you create a Preview Environment?
You can find the namespace by typing jx get preview
then to see if there is a Service
in your environment try kubectl get service -n jx-myuser-myapp-pr-1
Solution is to move mysql.yaml
from resources
to templates
sub-folder:
charts/preview/templates/mysql.yaml
Issue was cause by a typo in Service Linking documentation which is now corrected.