<p>My goal is to have a Kubernetes Service with dynamic annotation value, is it possible to bind ConfigMap object within Kubernetes Service annotation. Tried googling the question unfortunately
without success. My experience to use ConfigMap only in conjunction with Deployment. My guess it's not possible but wanted to have a confirmation. Probably someone knows a way to have it.
I always is able to create my Kubernetes Service using direct kubectl command without providing yaml file and set the annotation value from system env values for example, I'm curious if there more elegant way to do this.</p>

<p>Thanks   </p>

<p>Use <a href="https://helm.sh/" rel="nofollow noreferrer">helm</a>.</p>

<p>This requires setting up a helm <a href="https://helm.sh/docs/topics/charts/" rel="nofollow noreferrer">"chart"</a> for your deploy which includes a set of yaml templates. </p>

<pre><code>helm create my-app
</code></pre>

<p>An example service template with a variable annotation <code>./my-app/templates/service.yaml</code></p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    app: my-app-service
  name: my-app-service
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: {{ .Values.service.certarn }}
spec:
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: 8091
  selector:
    app: my-app-instance
  type: LoadBalancer
</code></pre>

<p>Then the "value" can be set at deploy time:</p>

<pre><code>helm install ./my-app -v certarn=12345:12345:123454513433
</code></pre>

<p>Normally you end up with lots of values with a more complex structure so you end up with dev/test/prod values file:</p>

<pre><code>helm install ./my-app -f values.dev.yaml 
</code></pre>
