title: How to get a service's NodePort and external IP in a Helm chart template?
body: <p>My Helm chart (run by Rancher pipeline)'s structure is:</p>
  <pre><code>charts/web/0.3.0/templates
    deployment.yaml
    service.yaml
    ingress.yaml
    webinspect-runner.yaml
  </code></pre>
  <p>The <code>deployment.yaml</code> deploys a web server (say flask-restful or django), and I set a service to it:</p>
  <h2>service.yaml</h2>
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: {{ include &quot;web.name&quot; . }}-svc
    labels:
      {{- include &quot;iiidevops.labels&quot; . | nindent 4 }}
  spec:
    type: NodePort
    selector:
      app: {{ include &quot;web.name&quot; . }}
    ports:
        - port: {{ .Values.web.port }}
          protocol: TCP
  </code></pre>
  <p>And I want to create a web scan (by webinspect) service to scan it, so I write this:</p>
  <h2>webinspect-runner.yaml</h2>
  <pre><code>apiVersion: batch/v1
  kind: Job
  metadata:
    annotations:
      &quot;helm.sh/hook&quot;: post-install,post-upgrade,post-rollback
      &quot;helm.sh/hook-delete-policy&quot;: before-hook-creation,hook-succeeded
    name: &quot;{{ .Release.Name }}-webinspect-{{ .Values.pipeline.sequence }}&quot;
  spec:
    template:
      metadata:
        name: &quot;{{ .Release.Name }}-webinspect-{{ .Values.pipeline.sequence }}&quot;
        labels:
          {{- include &quot;iiidevops.labels&quot; . | nindent 8 }}
      spec:
        containers:
          - name: &quot;webinspect-runner-{{ .Values.pipeline.sequence }}&quot;
            image: &quot;{{ .Values.harbor.host }}/{{ .Values.harbor.cache }}/iiiorg/webinspect-runner:{{ .Values.webinspect.runnerVersion }}&quot;
            command: ['sh', '-c', 'cd /usr/src/app; node /usr/src/app/app.js;']
            env:
              - name: inspect_url
                value: http://{{ .Release.Name }}.{{ .Values.ingress.externalHost }}{{ .Values.webinspect.startPath }}
  ...
     restartPolicy: Never
    backoffLimit: 4
  </code></pre>
  <p>The point is <code>inspect_url</code> env. I now use an external domain and ingress to redirect it, but it requires a domain name.</p>
  <p>Since <code>kubectl</code> can get the service's IP and port like <code>http://10.50.40.99:32147</code>, can I also write something to let <code>inspect_url</code> also become <code>http://10.50.40.99:32147</code>?</p>