<p>Below is the example to add Virtual Server and VirtualServerRoute in kubernetes-ingress.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
  name: virtualserver
spec:
  host: localhost
  routes:
  - path: /
    route: virtualserverroute
---
apiVersion: k8s.nginx.org/v1
kind: VirtualServerRoute
metadata:
  name: virtualserverroute
spec:
  host: localhost
  upstreams:
  - name: proxy
    service: proxy
    port: 80
  - name: webserverv1
    service: webserverv1
    port: 80
  - name: webserverv2
    service: webserverv2
    port: 80
  subroutes:
  - path: /webserverv1
    action:
      pass: webserverv1
  - path: /webserverv2
    action:
      pass: webserverv2
  - path: /
    action:
      pass: proxy</code></pre>
</div>
</div>
</p>

<p>Anyone knows How to get list of NGINX VirtualServer and VirtualServerRoute for that ingress in K8S?</p>

Dhaval Thakkar
<blockquote>
  <p>Anyone knows How to get list of NGINX VirtualServer and VirtualServerRoute for that ingress in K8S?</p>
</blockquote>

<p>You can list resources like <code>VirtualServer</code> and <code>VirtualServerRoute</code> by invoking below command: </p>

<ul>
<li><code>$ kubectl get VirtualServer</code> or <code>kubectl get vs</code></li>
<li><code>$ kubectl get VirtualServerRoute</code> or <code>kubectl get vsr</code></li>
</ul>

<p><strong>Please have in mind that above resources are <code>Custom Resources</code> and they should be added to Kubernetes.</strong> </p>

<hr>

<p><code>VirtualServer</code> as well as <code>VirtualServerRoute</code> are connected <strong>specifically</strong> to the Nginx Ingress Controller created by NginxInc. </p>

<p>Github link: <a href="https://github.com/nginxinc/kubernetes-ingress" rel="nofollow noreferrer"> Nginxinc: Kubernetes Ingress</a></p>

<p>As said on the Github site: </p>

<blockquote>
  <p>Note: this project is <strong>different</strong> from the NGINX Ingress controller in <a href="https://github.com/kubernetes/ingress-nginx" rel="nofollow noreferrer">kubernetes/ingress-nginx</a> repo. See <a href="https://github.com/nginxinc/kubernetes-ingress/blob/master/docs/nginx-ingress-controllers.md" rel="nofollow noreferrer">this doc</a> to find out about the key differences.</p>
  
  <p> <em><a href="https://github.com/nginxinc/kubernetes-ingress" rel="nofollow noreferrer">Github.com: Nginxinc: Kubernetes Ingress</a></em> </p>
</blockquote>

<p>To be able to create: </p>

<ul>
<li><code>VirtualServer</code></li>
<li><code>VirtualServerRoute</code> </li>
</ul>

<p>resources you will need to follow <a href="https://github.com/nginxinc/kubernetes-ingress#getting-started" rel="nofollow noreferrer">this documentation</a>.</p>

<p>If you are using the manifests with <code>git</code> please make sure that you apply following manifests: </p>

<pre class="lang-sh prettyprint-override"><code>$ kubectl apply -f common/vs-definition.yaml
$ kubectl apply -f common/vsr-definition.yaml
$ kubectl apply -f common/ts-definition.yaml
</code></pre>

<p>As they are <code>CRD's</code> for above resources. </p>

<p>After successful provisioning of <code>nginx-ingress</code> you should be able to create <code>VirtualServer</code> and <code>VirtualServerRoute</code> and get more information about them with: </p>

<ul>
<li><code>kubectl describe vs</code></li>
<li><code>kubectl describe vsr</code> </li>
</ul>
