Combine istioctl commands with kubectl-select

Since working with Istio I stumbled a couple of times over some of the istioctl commands that require to select a specific pod or service.

Some of these commands are istioctl…

  • …dashboard controlz {Istio pilot pod name}
  • …dashboard envoy {pod name}
  • …experimental describe service {service name}
  • …experimental metrics {service name}
  • …proxy-config bootstrap {pod name}

For instance, you would like to access the Envoy dashboard to get information for a specific Envoy sidecar proxy, you run istioctl dashboard envoy {pod name}.

When you do this a couple of times for different pods, you consider using some supportive tooling to select the specific pod.

Brendan Burns, Kubernetes co-founder, has written a small Go-based kubectl plugin called kubectl-select.

-> https://github.com/brendandburns/kubectl-select

kubectl-select displays Kubernetes resources like pods or services as a list for selection.

As seen in the screenshot I get a list of pods and can easily select one to start the Envoy dashboard to check the Envoy proxy configuration.

My alias ide represents the command istioctl dashboard envoy `kubectl select pods`. That makes my life easier, when I want to access the Envoy dashboard for a specific pod.

Instead of using the Envoy dashboard you can run a couple of istioctl proxy-config commands like the bootstrap command to check the configuration.

Combining the istioctl command with kubectl-select and jq is a powerful mix, especially using the alias ipcb for it.

As I said kubectl-select also support Kubernetes services. So, it is easy to get information about the Kubernetes service in the context of Istio running istioctl experimental describe service.

Another handy shortcut is the istioctl experimental metrics command to check some statistics for the selected service.

Exceptionally, when you cannot use the Istio Grafana dashboard, but you want to get this kind of information.

I am using the following aliases for the different istioctl commands combined with kubectl-select.

alias idg='istioctl dashboard grafana'
alias idj='istioctl dashboard jaeger'
alias idp='istioctl dashboard prometheus'
alias idc='istioctl dashboard controlz -n istio-system `kubectl select pods -n istio-system -l istio=pilot`'
alias ide='istioctl dashboard envoy `kubectl select pods`'
alias ips='istioctl proxy-status'
alias iat='istioctl authn tls-check `kubectl select pods`'
alias ixac='istioctl experimental authz check `kubectl select pods`'
alias ixdp='istioctl experimental describe pod `kubectl select pods`'
alias ixds='istioctl experimental describe service `kubectl select service`'
alias ixm='istioctl experimental metrics `kubectl select service`'
alias ipcb='istioctl proxy-config bootstrap `kubectl select pods` | jq .'
alias ipcc='istioctl proxy-config cluster `kubectl select pods`'
alias ipce='istioctl proxy-config endpoint `kubectl select pods`'
alias ipcl='istioctl proxy-config listener `kubectl select pods`'
alias ipclog='istioctl proxy-config log `kubectl select pods`'
alias ipcr='istioctl proxy-config route `kubectl select pods`'
alias ipcs='istioctl proxy-config secret `kubectl select pods`'

You can also find the alias file on my GitHub repository.

-> https://github.com/neumanndaniel/zsh-public/blob/master/alias/istioctl_alias

Facebooktwitterlinkedinmail