<p>I wanted to know exactly what is the difference between '&gt;-' and  '|-' especially in kubernetes yaml manifests</p>

Bguess
<p>Newlines in folded block scalars (<code>&gt;</code>) are subject to line folding, newlines in literal block scalars (<code>|</code>) are not.</p>
<p>Line folding replaces a single newline between non-empty lines with a space, and in the case of empty lines, reduces the number of newline characters between the surrounding non-empty lines by one:</p>
<pre class="lang-yaml prettyprint-override"><code>a: &gt; # folds into &quot;one two\nthree four\n\nfive\n&quot;
  one
  two

  three
  four


  five
</code></pre>
<p>Line folding does not occur between lines when at least one line is more indented, i.e. contains whitespace at the beginning that is not part of the block's general indentation:</p>
<pre class="lang-yaml prettyprint-override"><code>a: &gt; # folds into &quot;one\n  two\nthree four\n\n five\n&quot;
  one
    two
  three
  four

   five
</code></pre>
<p>Adding <code>-</code> after either <code>|</code> or <code>&gt;</code> will strip the newline character from the last line:</p>
<pre class="lang-yaml prettyprint-override"><code>a: &gt;- # folded into &quot;one two&quot;
  one
  two
b: &gt;- # folded into &quot;one\ntwo&quot;
  one

  two
</code></pre>
<p>In contrast, <code>|</code> emits every newline character as-is, the sole exception being the last one if you use <code>-</code>.</p>
