-
Suggestion
-
Resolution: Done
-
None
-
None
-
None
Issue Summary
When using Service Type NodePort for Confluence/Synchrony, a random port number is assigned for the NodePort.
Steps to Reproduce
- Deploy Confluence with Synchrony enabled and with the following:
--set confluence.service.type=NodePort --set synchrony.service.type=NodePort
- Once Confluence is deployed, check the output of kubectl get service
% kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE confluencelocalmsb NodePort 10.104.103.92 <none> 80:30090/TCP,5701:30096/TCP 34s confluencelocalmsb-synchrony NodePort 10.107.216.47 <none> 80:30389/TCP,5701:32456/TCP 34s
- In the above, Confluence node port is assigned port 30090 and Synchrony node port is assigned port 30389
- Undeploy Confluence
- Redeploy Confluence again
Expected Results
The same allocated Port Number is assigned for the Confluence/Synchrony node port service.
Actual Results
Checking the output of kubectl get service and it has been assigned a different port number for the NodePort
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE confluencelocalmsb NodePort 10.98.136.184 <none> 80:31997/TCP,5701:31407/TCP 5s confluencelocalmsb-synchrony NodePort 10.104.184.35 <none> 80:32518/TCP,5701:32171/TCP 5s
In the above, Confluence node port is now assigned port 31997 and Synchrony node port is assigned port 32518
–
When setting .service.type to NodePort, the following message is incorrectly printed as part of the Helm Chart deployment
Get the Confluence URL by running these commands in the same shell: export NODE_PORT=$(kubectl get --namespace atlassian -o jsonpath="{.spec.ports[0].nodePort}" services confluencelocalmsb-confluence) export NODE_IP=$(kubectl get nodes --namespace atlassian -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT For further documentation, see https://atlassian.github.io/data-center-helm-charts/
Manually running:
kubectl get --namespace atlassian -o jsonpath="{.spec.ports[0].nodePort}" services confluencelocalmsb-confluence
will result in this error
Error from server (NotFound): services "confluencelocalmsb-confluence" not found
because the deployed Service Name should have been just confluencelocalmsb:
% kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE confluencelocalmsb NodePort 10.100.5.119 <none> 80:32111/TCP,81:31562/TCP,5701:30424/TCP 7m37s confluencelocalmsb-synchrony NodePort 10.109.73.163 <none> 81:31803/TCP,5701:32468/TCP 7m37s
Suggested Resolution
Provide a port number parameter in the Helm Chart to specify the NodePort that should be allocated for Confluence and Synchrony service when using Service type NodePort.
Update the Helm Chart values with the following new parameters:
confluence: service: # -- Use specific port for NodePort. The range of valid ports is 30000-32767. Only applies to service type NodePort. # nodePort: synchrony: service: # -- Use specific port for NodePort. The range of valid ports is 30000-32767. Only applies to service type NodePort. # nodePort:
Update the Helm Chart source src/main/charts/confluence/templates/service.yaml:
ports: - port: {{ .Values.confluence.service.port }} targetPort: http protocol: TCP name: http
ports: - port: {{ .Values.confluence.service.port }} targetPort: http protocol: TCP name: http {{- if eq .Values.confluence.service.type "NodePort" }} nodePort: {{ .Values.confluence.service.nodePort }} {{- end }}
Update the Helm Chart source src/main/charts/confluence/templates/service-synchrony.yaml:
ports: - port: {{ .Values.synchrony.service.port }} targetPort: http protocol: TCP name: http
ports: - port: {{ .Values.synchrony.service.port }} targetPort: http protocol: TCP name: http {{- if eq .Values.synchrony.service.type "NodePort" }} nodePort: {{ .Values.synchrony.service.nodePort }} {{- end }}
Workaround
- Clone and download the Data Center Helm Charts https://github.com/atlassian/data-center-helm-charts onto your local disk
- Manually edit the Confluence <localrepo>/src/main/charts/confluence/templates/service.yaml
FROM
- port: {{ .Values.confluence.service.port }} targetPort: http protocol: TCP name: http
TO- port: {{ .Values.confluence.service.port }} targetPort: http protocol: TCP name: http {{- if eq .Values.confluence.service.type "NodePort" }} nodePort: 32359 {{- end }}
- Also update the Synchrony <localrepo>/src/main/charts/confluence/templates/service-synchrony.yaml
FROM
ports: - port: {{ .Values.synchrony.service.port }} targetPort: http protocol: TCP name: http
TOports: - port: {{ .Values.synchrony.service.port }} targetPort: http protocol: TCP name: http {{- if eq .Values.synchrony.service.type "NodePort" }} nodePort: 32360 {{- end }}
- The above will then deploy Confluence on the hard coded NodePort of 32359 and Synchrony on the hard coded NodePort of 32360 - feel free to use any value between 30000-32767
- Manually edit the Confluence <localrepo>/src/main/charts/confluence/templates/service.yaml
- When deploying Confluence, instead of using the atlassian-data-center/confluence, you'll need to reference the local repo, e.g.
FROM
helm install confluence atlassian-data-center/confluence --values .........
TO# e.g if the repo was downloaded to /home/confluence/repo/data-center-helm-charts cd /home/confluence/repo/data-center-helm-charts # run this once only helm dependency build # deploy using the modified service.yaml and service-synchrony.yaml files helm install confluence /home/confluence/repo/data-center-helm-charts/src/main/charts/confluence --values .........