调试 Ingress Nginx
发布日期:2021-05-08 23:25:42 浏览次数:23 分类:博客文章

本文共 1062 字,大约阅读时间需要 3 分钟。

由于  是最受欢迎的 Ingress 控制器,因此接下来我们将介绍一些有关调试 ingress-nginx 的技巧。

调试 Ingress Nginx

Ingress-nginx 项目有一个 Kubectl 的

可以使用 kubectl ingress-nginx :

  • 检查日志,后端,证书等。
  • 连接到 ingress
  • 检查当前配置

应该尝试的三个命令是:

  • kubectl ingress-nginx lint,它会检查 nginx.conf 配置
  • kubectl ingress-nginx backend,它会检查后端(类似于kubectl describe ingress
  • kubectl ingress-nginx logs,查看日志

请注意,可能需要为 Ingress 控制器指定正确的名称空间 namespace

macOS/Linux

Bash or ZSH shells
Make sure that  is installed.

Run this command in your terminal to download and install krew:

 
(  set -x; cd "$(mktemp -d)" &&  curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.tar.gz" &&  tar zxvf krew.tar.gz &&  KREW=./krew-"$(uname | tr '[:upper:]' '[:lower:]')_amd64" &&  "$KREW" install krew)

Add $HOME/.krew/bin directory to your PATH environment variable. To do this, update your .bashrc or .zshrc file and append the following line:

export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

and restart your shell.

Verify running kubectl krew works.

安装 krew, 运行

kubectl krew install ingress-nginx

安装插件然后运行

kubectl ingress-nginx --help

上一篇:ingress-nginx配置多host指向相同后端
下一篇:unexpected status code 401

发表评论

最新留言

感谢大佬
[***.8.128.20]2025年03月23日 13时59分57秒