I followed all the instructions in https://kubernetes.io/docs/tasks/tools/included/optional-kubectl-configs-bash-linux/ to enable kubectl autocompletion.
I've the line source <(kubectl completion bash)
in ~/.bashrc
When I run the command . ./.bashrc
the autocompletion works fine.
When the shell restarts autocompletion doesn't work.
What am I missing?
I fixed the problem running
kubectl completion bash > $HOME/.bash_completion