<p>According to Kubernetes documentation</p>
<blockquote>
<p>The metadata in an annotation can be small or large, structured or unstructured, and can include characters not permitted by labels.</p>
<p>Annotations, like labels, are key/value maps</p>
</blockquote>
<p>Then there is <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set" rel="nofollow noreferrer">a detailed explanation</a> on the syntax of the annotation keys. But it says nothing about the value part.</p>
<p>Where can I find more about the allowed length and character set for the value of an annotation in Kubernetes?</p>

<p><a href="https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go#L47" rel="nofollow noreferrer">Here</a> you can find the code that validates annotations in current master:</p>
<pre class="lang-golang prettyprint-override"><code>func ValidateAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList {
    allErrs := field.ErrorList{}
    for k := range annotations {
        for _, msg := range validation.IsQualifiedName(strings.ToLower(k)) {
            allErrs = append(allErrs, field.Invalid(fldPath, k, msg))
        }
    }
    if err := ValidateAnnotationsSize(annotations); err != nil {
        allErrs = append(allErrs, field.TooLong(fldPath, &quot;&quot;, TotalAnnotationSizeLimitB))
    }
    return allErrs
}
</code></pre>
<p>The <code>keys</code> are validated according to the rules that you mentioned.
The only validation applied to the values is the <a href="https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go#L60" rel="nofollow noreferrer">total length of all annotations</a> (size of keys + size of values for all annotations) that can't be longer than 256 kB.</p>
<pre class="lang-golang prettyprint-override"><code>const TotalAnnotationSizeLimitB int = 256 * (1 &lt;&lt; 10) // 256 kB

...

func ValidateAnnotationsSize(annotations map[string]string) error {
    var totalSize int64
    for k, v := range annotations {
        totalSize += (int64)(len(k)) + (int64)(len(v))
    }
    if totalSize &gt; (int64)(TotalAnnotationSizeLimitB) {
        return fmt.Errorf(&quot;annotations size %d is larger than limit %d&quot;, totalSize, TotalAnnotationSizeLimitB)
    }
    return nil
}
</code></pre>
