<p>I'm looking to have a specific column, through my initial kubectl command</p>
<pre><code>kubectl --context oam-ska-yo_jonnylee -n ebzz get -o json ingressroute zz-oamtoto
</code></pre>
<p>This give me the json below</p>
<pre><code>{
    &quot;apiVersion&quot;:&quot;traefik.containo.us/v1alpha1&quot;,
    &quot;kind&quot;:&quot;IngressRoute&quot;,
    &quot;metadata&quot;:{
       &quot;annotations&quot;:{
          &quot;kubectl.kubernetes.io/last-applied-configuration&quot;:&quot;{&quot;sum-up&quot;}\n&quot;
       },
       &quot;creationTimestamp&quot;:&quot;2021-02-23T11:17:56Z&quot;,
       &quot;generation&quot;:1,
       &quot;labels&quot;:{
          &quot;instance&quot;:&quot;webzz&quot;
       },
       &quot;managedFields&quot;:[
          {
             &quot;apiVersion&quot;:&quot;traefik.containo.us/v1alpha1&quot;,
             &quot;fieldsType&quot;:&quot;FieldsV1&quot;,
             &quot;fieldsV1&quot;:{
                &quot;f:metadata&quot;:{
                   &quot;f:annotations&quot;:{
                      &quot;.&quot;:{
                         
                      },
                      &quot;f:kubectl.kubernetes.io/last-applied-configuration&quot;:{
                         
                      }
                   },
                   &quot;f:labels&quot;:{
                      &quot;.&quot;:{
                         
                      },
                      &quot;f:instance&quot;:{
                         
                      }
                   }
                },
                &quot;f:spec&quot;:{
                   &quot;.&quot;:{
                      
                   },
                   &quot;f:entryPoints&quot;:{
                      
                   },
                   &quot;f:routes&quot;:{
                      
                   }
                }
             },
             &quot;manager&quot;:&quot;kubectl&quot;,
             &quot;operation&quot;:&quot;Update&quot;,
             &quot;time&quot;:&quot;2021-02-23T11:17:56Z&quot;
          }
       ],
       &quot;name&quot;:&quot;zz-oamtoto&quot;,
       &quot;namespace&quot;:&quot;ebzz&quot;,
       &quot;resourceVersion&quot;:&quot;61112315&quot;,
       &quot;selfLink&quot;:&quot;/apis/traefik.containo.us/v1alpha1/namespaces/ebzz/ingressroutes/zz-oamtoto&quot;,
       &quot;uid&quot;:&quot;42727XXX-dd9e-45e4-9c7d-1225aea125&quot;
    },
    &quot;spec&quot;:{
       &quot;entryPoints&quot;:[
          &quot;http&quot;
       ],
       &quot;routes&quot;:[
          {
             &quot;kind&quot;:&quot;Rule&quot;,
             &quot;match&quot;:&quot;Host(`ebzz.acme.com`)&quot;,
             &quot;middlewares&quot;:[
                {
                   &quot;name&quot;:&quot;ebzz-ebzz-basicauth&quot;
                }
             ],
             &quot;services&quot;:[
                {
                   &quot;kind&quot;:&quot;Service&quot;,
                   &quot;name&quot;:&quot;zz-oamtoto&quot;,
                   &quot;port&quot;:1234
                }
             ]
          }
       ]
    }
 }
</code></pre>
<p>What I'm looking at is to find a specific column, the <code>routes</code> one and most of all, one of its specific sub-column</p>
<blockquote>
<p>&quot;match&quot;:&quot;Host('<code>ebzz.acme.com</code>')&quot;</p>
</blockquote>
<p>I tried the command below</p>
<pre><code>kubectl --context oam-ska-yo_jonnylee -n ebzz get -o=custom-columns=svc:.spec.routes.-kind ingressroute zz-oamtoto
</code></pre>
<p>Which gives me this:</p>
<pre><code> [map[kind:Rule match:Host(`ebzz.acme.com`) middlewares:[map[name:ebzz-ebzz-basicauth]] services:[map[kind:Service name:zz-oamtoto port:1234]]]]
</code></pre>
<p>What i've tried so far</p>
<pre><code>kubectl --context oam-ska-yo_jonnylee -n ebzz get -o=custom-columns=svc:.spec.routes[kind] ingressroute zz-oamtoto
</code></pre>
<p>It gives me this</p>
<pre><code>svc
error: invalid array index kind
</code></pre>
<p>I've tried this as well</p>
<pre><code>kubectl --context oam-ska-yo_jonnylee -n ebzz get -o=custom-columns=svc:.spec.routes[&quot;kind&quot;] ingressroute zz-oamtoto
</code></pre>
<p>But it gives me this</p>
<pre><code>svc
error: invalid array index kind
</code></pre>

Andy K
<p>After many trials, this one works</p>
<pre><code>kubectl --context oam-ska-yo_jonnylee -n ebz get -o=custom-columns=.spec.routes[0].match ingressroute zz-oamtoto
</code></pre>
<ul>
<li><p>The option <code>custom-columns</code> should give you the tuning if you are looking for a column.</p>
</li>
<li><p>For the first column, you are aiming to, you need to put a <code>.spec</code> followed by a dot and the column name, like this <code>.spec.column_name</code></p>
</li>
<li><p>Once there, the <code>routes</code> column part, in this example, is an array. Therefore you need to put the <code>[]</code>, followed by the number and then followed by the subname, here <code>match</code>. it gives you <code>.spec.routes[0].match</code></p>
</li>
</ul>
<p>Note: I use a svc in my initial kubectly query. It was a mistake, there is no use for that.</p>
