<p>I am trying to set annotations on my Service object in Kubernetes, but for some reason (even tho the k8s master accepts my request) the annotations are not being set.  Here is my YAML file:</p>

<pre><code>---
apiVersion: v1
kind: Service
metadata:
  name: myapp
  labels:
    app: myapp
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: 'arn:aws:acm:us-west-2:&lt;redacted&gt;:certificate/&lt;redacted&gt;'
    service.beta.kubernetes.io/aws-load-balancer-ssl-negotiation-policy: 'ELBSecurityPolicy-TLS-1-2-2017-01'
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: 'http'   
    service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: 'app=myapp'
    service.beta.kubernetes.io/aws-load-balancer-access-log-enabled: true
spec:
  type: LoadBalancer
  selector:
    app: myapp-web
  ports:
    - protocol: TCP
      port: 80
      targetPort: 3000
</code></pre>

<p>I can then apply the file without error:</p>

<pre><code>[ben@ubuntu simplenexus.com]$ kc apply -f deploy/k8s/service.yaml
service/myapp created
</code></pre>

<p>However querying the object returns with none of the annotations:</p>

<pre><code>[ben@ubuntu simplenexus.com]$ kc get svc myapp -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"myapp"},"name":"myapp","namespace":"default"},"spec":{"ports":[{"port":80,"protocol":"TCP","targetPort":3000}],        "selector":{"app":"myapp-web"},"type":"LoadBalancer"}}
  creationTimestamp: "2019-04-11T16:27:45Z"
  labels:
    app: myapp
  name: myapp
  namespace: default
  resourceVersion: "2085328"
  selfLink: /api/v1/namespaces/default/services/myapp
  uid: &lt;redacted&gt;
spec:
  clusterIP: &lt;redacted&gt;
  externalTrafficPolicy: Cluster
  ports:
  - nodePort: 32118
    port: 80
    protocol: TCP
    targetPort: 3000
  selector:
    app: myapp-web
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - hostname: &lt;redacted&gt;.us-west-2.elb.amazonaws.com
</code></pre>

<p>I can manually set annotations, and they stay:</p>

<pre><code>[ben@ubuntu simplenexus.com]$ kc annotate svc myapp newannot=success
service/myapp annotated
[ben@ubuntu simplenexus.com]$ kc get svc myapp -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"myapp"},"name":"myapp","namespace":"default"},"spec":{"ports":[{"port":80,"protocol":"TCP","targetPort":3000}],        "selector":{"app":"myapp-web"},"type":"LoadBalancer"}}
    newannot: success
  creationTimestamp: "2019-04-11T16:27:45Z"
  labels:
    app: myapp
  name: myapp
  namespace: default
  resourceVersion: "2085328"
  selfLink: /api/v1/namespaces/default/services/myapp
  uid: &lt;redacted&gt;
  ...
</code></pre>

<p>Am I doing this wrong?  What's the proper way to set annotations on a Kubernetes Service object in a YAML file?</p>

<p>It turns out you can't use boolean values in annotations, here's ongoing <a href="https://github.com/kubernetes/kubernetes/issues/59113" rel="nofollow noreferrer">bug report</a> for it. Annotation values must be strings, so you'll need to sanitize it by putting values in brackets <code>'...'</code>.</p>

<p>I deployed your YAML and it worked with:</p>

<pre><code>    service.beta.kubernetes.io/aws-load-balancer-access-log-enabled: 'true'
</code></pre>
