Skip to content

Commit c7493f9

Browse files
authored
Merge pull request #594 from citrix/cic-1.34.16-updates
added the external name service support
2 parents 8a08466 + 9445ad9 commit c7493f9

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Support for external name service across namespaces
2+
3+
Namespaces are used to isolate resources within a Kubernetes cluster. Sometimes, services in a different namespace might have to access a service located in another namespace. In such scenarios, you can use the `ExternalName` service provided by Kubernetes. An `ExternalName` service is a special service that does not have selectors and instead uses DNS names.
4+
5+
In the service definition, the `externalName` field must point to the namespace and also to the service which we are trying to access on that namespace. Citrix ingress controller supports services of type `ExternalName` when you have to access services within the cluster.
6+
7+
When you create the `ExternalName` service, the following criteria must be met:
8+
9+
- The `externalName` field in the service definition must follow the format:
10+
`svc: <name-of-the-service>.<namespace-of-the-service>.svc.cluster.local`
11+
- The port number in the `ExternalName` service must exactly match the port number of the targetted service.
12+
13+
**Note:**
14+
When the service of an application is outside the Kubernetes cluster and you have created an `ExternalName` service, you can resolve the domain name using the [Traffic management for external services feature](https://docs.netscaler.com/en-us/citrix-k8s-ingress-controller/how-to/external-load-balance-adc.html).
15+
16+
## Sample ExternalName service
17+
18+
In this example, a `mysql` service is running in the default namespace and a sample `ExternalName` service is created to access the `mysql` service from the `namespace1` namespace.
19+
20+
The following is a sample service definition for a MySQL service running in the default namespace.
21+
22+
```yml
23+
apiVersion: v1
24+
kind: Service
25+
metadata:
26+
name: mysql
27+
namespace: default
28+
spec:
29+
clusterIP: None
30+
ports:
31+
- port: 3306
32+
protocol: TCP
33+
targetPort: 3306
34+
selector:
35+
app: mysql
36+
type: ClusterIP
37+
38+
```
39+
40+
The following is a sample `ExternalName` service definition to access the `mysql` service from the `namespace1` namespace.
41+
42+
```yml
43+
kind: Service
44+
apiVersion: v1
45+
metadata:
46+
name: dbservice
47+
namespace: namespace1
48+
spec:
49+
type: ExternalName
50+
externalName: mysql.default.svc.cluster.local
51+
ports:
52+
- port: 3306
53+
protocol: TCP
54+
targetPort: 3306
55+
```
56+
57+
In the example, the service points to the namespace where `mysql` is deployed as specified in the field `externalName: mysql.default.svc.cluster.local`. Here `mysql` is the service name and `default` is the namespace. You can see that the port name is also the same as the `mysql` service.

0 commit comments

Comments
 (0)