</code></pre></div><p>to install the plugin. Then run</p><divclass=highlight><pre><span></span><code><spanclass=go>kubectl ingress-nginx --help</span>
</code></pre></div><p>to make sure the plugin is properly installed and to get a list of commands:</p><divclass=highlight><pre><span></span><code><spanclass=go>kubectl ingress-nginx --help</span>
<spanclass=go>A kubectl plugin for inspecting your ingress-nginx deployments</span>
<spanclass=go>Usage:</span>
<spanclass=go> ingress-nginx [command]</span>
<spanclass=go>Available Commands:</span>
<spanclass=go> backends Inspect the dynamic backend information of an ingress-nginx instance</span>
<spanclass=go> certs Output the certificate data stored in an ingress-nginx pod</span>
<spanclass=go> conf Inspect the generated nginx.conf</span>
<spanclass=go> exec Execute a command inside an ingress-nginx pod</span>
<spanclass=go> general Inspect the other dynamic ingress-nginx information</span>
<spanclass=go> help Help about any command</span>
<spanclass=go> info Show information about the ingress-nginx service</span>
<spanclass=go> ingresses Provide a short summary of all of the ingress definitions</span>
<spanclass=go> lint Inspect kubernetes resources for possible issues</span>
<spanclass=go> logs Get the kubernetes logs for an ingress-nginx pod</span>
<spanclass=go> ssh ssh into a running ingress-nginx pod</span>
<spanclass=go>Flags:</span>
<spanclass=go> --as string Username to impersonate for the operation</span>
<spanclass=go> --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups.</span>
<spanclass=go> --certificate-authority string Path to a cert file for the certificate authority</span>
<spanclass=go> --client-certificate string Path to a client certificate file for TLS</span>
<spanclass=go> --client-key string Path to a client key file for TLS</span>
<spanclass=go> --cluster string The name of the kubeconfig cluster to use</span>
<spanclass=go> --context string The name of the kubeconfig context to use</span>
<spanclass=go> -h, --help help for ingress-nginx</span>
<spanclass=go> --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure</span>
<spanclass=go> --kubeconfig string Path to the kubeconfig file to use for CLI requests.</span>
<spanclass=go> -n, --namespace string If present, the namespace scope for this CLI request</span>
<spanclass=go> --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")</span>
<spanclass=go> -s, --server string The address and port of the Kubernetes API server</span>
<spanclass=go> --token string Bearer token for authentication to the API server</span>
<spanclass=go> --user string The name of the kubeconfig user to use</span>
<spanclass=go>Use "ingress-nginx [command] --help" for more information about a command.</span>
</code></pre></div><h2id=common-flags>Common Flags<aclass=headerlinkhref=#common-flagstitle="Permanent link"> ¶</a></h2><ul><li>Every subcommand supports the basic <code>kubectl</code> configuration flags like <code>--namespace</code>, <code>--context</code>, <code>--client-key</code> and so on.</li><li>Subcommands that act on a particular <code>ingress-nginx</code> pod (<code>backends</code>, <code>certs</code>, <code>conf</code>, <code>exec</code>, <code>general</code>, <code>logs</code>, <code>ssh</code>), support the <code>--deployment <deployment></code> and <code>--pod <pod></code> flags to select either a pod from a deployment with the given name, or a pod with the given name. The <code>--deployment</code> flag defaults to <code>nginx-ingress-controller</code>.</li><li>Subcommands that inspect resources (<code>ingresses</code>, <code>lint</code>) support the <code>--all-namespaces</code> flag, which causes them to inspect resources in every namespace.</li></ul><h2id=subcommands>Subcommands<aclass=headerlinkhref=#subcommandstitle="Permanent link"> ¶</a></h2><p>Note that <code>backends</code>, <code>general</code>, <code>certs</code>, and <code>conf</code> require <code>ingress-nginx</code> version <code>0.23.0</code> or higher.</p><h3id=backends>backends<aclass=headerlinkhref=#backendstitle="Permanent link"> ¶</a></h3><p>Run <code>kubectl ingress-nginx backends</code> to get a JSON array of the backends that an ingress-nginx controller currently knows about:</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl ingress-nginx backends -n ingress-nginx
</code></pre></div><p>Add the <code>--list</code> option to show only the backend names. Add the <code>--backend <backend></code> option to show only the backend with the given name.</p><h3id=certs>certs<aclass=headerlinkhref=#certstitle="Permanent link"> ¶</a></h3><p>Use <code>kubectl ingress-nginx certs --host <hostname></code> to dump the SSL cert/key information for a given host.</p><p><strong>WARNING:</strong> This command will dump sensitive private key information. Don't blindly share the output, and certainly don't log it anywhere.</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl ingress-nginx certs -n ingress-nginx --host testaddr.local
</code></pre></div><h3id=conf>conf<aclass=headerlinkhref=#conftitle="Permanent link"> ¶</a></h3><p>Use <code>kubectl ingress-nginx conf</code> to dump the generated <code>nginx.conf</code> file. Add the <code>--host <hostname></code> option to view only the server block for that host:</p><divclass=highlight><pre><span></span><code><spanclass=go>kubectl ingress-nginx conf -n ingress-nginx --host testaddr.local</span>
<spanclass=go> set $proxy_upstream_name "-";</span>
<spanclass=go> set $pass_access_scheme $scheme;</span>
<spanclass=go> set $pass_server_port $server_port;</span>
<spanclass=go> set $best_http_host $http_host;</span>
<spanclass=go> set $pass_port $pass_server_port;</span>
<spanclass=go> location / {</span>
<spanclass=go> set $namespace "";</span>
<spanclass=go> set $ingress_name "";</span>
<spanclass=go> set $service_name "";</span>
<spanclass=go> set $service_port "0";</span>
<spanclass=go> set $location_path "/";</span>
<spanclass=go>...</span>
</code></pre></div><h3id=exec>exec<aclass=headerlinkhref=#exectitle="Permanent link"> ¶</a></h3><p><code>kubectl ingress-nginx exec</code> is exactly the same as <code>kubectl exec</code>, with the same command flags. It will automatically choose an <code>ingress-nginx</code> pod to run the command in.</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl ingress-nginx <spanclass=nb>exec</span> -i -n ingress-nginx -- ls /etc/nginx
<spanclass=go>fastcgi_params</span>
<spanclass=go>geoip</span>
<spanclass=go>lua</span>
<spanclass=go>mime.types</span>
<spanclass=go>modsecurity</span>
<spanclass=go>modules</span>
<spanclass=go>nginx.conf</span>
<spanclass=go>opentracing.json</span>
<spanclass=go>owasp-modsecurity-crs</span>
<spanclass=go>template</span>
</code></pre></div><h3id=info>info<aclass=headerlinkhref=#infotitle="Permanent link"> ¶</a></h3><p>Shows the internal and external IP/CNAMES for an <code>ingress-nginx</code> service.</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl ingress-nginx info -n ingress-nginx
<spanclass=go>Service cluster IP address: 10.187.253.31</span>
</code></pre></div><p>Use the <code>--service <service></code> flag if your <code>ingress-nginx</code><code>LoadBalancer</code> service is not named <code>ingress-nginx</code>.</p><h3id=ingresses>ingresses<aclass=headerlinkhref=#ingressestitle="Permanent link"> ¶</a></h3><p><code>kubectl ingress-nginx ingresses</code>, alternately <code>kubectl ingress-nginx ing</code>, shows a more detailed view of the ingress definitions in a namespace. Compare:</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl get ingresses --all-namespaces
<spanclass=go>NAMESPACE NAME HOSTS ADDRESS PORTS AGE</span>
<spanclass=go>NAMESPACE INGRESS NAME HOST+PATH ADDRESSES TLS SERVICE SERVICE PORT ENDPOINTS</span>
<spanclass=go>default example-ingress1 testaddr.local/etameta localhost NO pear-service 5678 5</span>
<spanclass=go>default example-ingress1 testaddr2.local/otherpath localhost NO apple-service 5678 1</span>
<spanclass=go>default example-ingress1 testaddr2.local/otherotherpath localhost NO pear-service 5678 5</span>
<spanclass=go>default test-ingress-2 * localhost NO echo-service 8080 2</span>
</code></pre></div><h3id=lint>lint<aclass=headerlinkhref=#linttitle="Permanent link"> ¶</a></h3><p><code>kubectl ingress-nginx lint</code> can check a namespace or entire cluster for potential configuration issues. This command is especially useful when upgrading between <code>ingress-nginx</code> versions.</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl ingress-nginx lint --all-namespaces --verbose
<spanclass=go>Checking ingresses...</span>
<spanclass=go>✗ anamespace/this-nginx</span>
<spanclass=go> - Contains the removed session-cookie-hash annotation.</span>
<spanclass=go> Lint added for version 0.24.0</span>
</code></pre></div><p>to show the lints added <strong>only</strong> for a particular <code>ingress-nginx</code> release, use the <code>--from-version</code> and <code>--to-version</code> flags:</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl ingress-nginx lint --all-namespaces --verbose --from-version <spanclass=m>0</span>.24.0 --to-version <spanclass=m>0</span>.24.0
<spanclass=go>Checking ingresses...</span>
<spanclass=go>✗ anamespace/this-nginx</span>
<spanclass=go> - Contains the removed session-cookie-hash annotation.</span>
<spanclass=go> Lint added for version 0.24.0</span>
</code></pre></div><h3id=logs>logs<aclass=headerlinkhref=#logstitle="Permanent link"> ¶</a></h3><p><code>kubectl ingress-nginx logs</code> is almost the same as <code>kubectl logs</code>, with fewer flags. It will automatically choose an <code>ingress-nginx</code> pod to read logs from.</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl ingress-nginx logs -n ingress-nginx
<spanclass=go>W0405 16:53:46.070093 7 client_config.go:549] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.</span>
<spanclass=go>I0405 16:53:46.070499 7 main.go:205] Creating API client for https://10.96.0.1:443</span>
<spanclass=go>I0405 16:53:46.077784 7 main.go:249] Running in Kubernetes cluster version v1.10 (v1.10.11) - git (clean) commit 637c7e288581ee40ab4ca210618a89a555b6e7e9 - platform linux/amd64</span>
</code></pre></div><h3id=ssh>ssh<aclass=headerlinkhref=#sshtitle="Permanent link"> ¶</a></h3><p><code>kubectl ingress-nginx ssh</code> is exactly the same as <code>kubectl ingress-nginx exec -it -- /bin/bash</code>. Use it when you want to quickly be dropped into a shell inside a running <code>ingress-nginx</code> container.</p><divclass=highlight><pre><span></span><code><spanclass=gp>$</span> kubectl ingress-nginx ssh -n ingress-nginx
</code></pre></div></article></div></div></main><footerclass=md-footer><divclass=md-footer-nav><navclass="md-footer-nav__inner md-grid"aria-label=Footer><ahref=../troubleshooting/class="md-footer-nav__link md-footer-nav__link--prev"rel=prev><divclass="md-footer-nav__button md-icon"><svgxmlns=http://www.w3.org/2000/svgviewbox="0 0 24 24"><pathd="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg></div><divclass=md-footer-nav__title><divclass=md-ellipsis><spanclass=md-footer-nav__direction> Previous </span> Troubleshooting </div></div></a><ahref=../deploy/class="md-footer-nav__link md-footer-nav__link--next"rel=next><divclass=md-footer-nav__title><divclass=md-ellipsis><spanclass=md-footer-nav__direction> Next </span> Installation Guide </div></div><divclass="md-footer-nav__button md-icon"><svgxmlns=http://www.w3.org/2000/svgviewbox="0 0 24 24"><pathd="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg></div></a></nav></div><divclass="md-footer-meta md-typeset"><divclass="md-footer-meta__inner md-grid"><divclass=md-footer-copyright> Made with <ahref=https://squidfunk.github.io/mkdocs-material/target=_blankrel=noopener> Material for MkDocs </a></div></div></div></footer></div><scriptsrc=../assets/javascripts/vendor.93c04032.min.js></script><scriptsrc=../assets/javascripts/bundle.83e5331e.min.js></script><scriptid=__langtype=application/json>{"clipboard.copy":"Copy to clipboard","clipboard.copied":"Copied to clipboard","search.config.lang":"en","search.config.pipeline":"trimmer, stopWordFilter","search.config.separator":"[\\s\\-]+","search.placeholder":"Search","search.result.placeholder":"Type to start searching","search.result.none":"No matching documents","search.result.one":"1 matching document","search.result.other":"# matching documents","search.result.more.one":"1 more on this page","search.result.more.other":"# more on this page","search.result.term.missing":"Missing"}</script><script>