Introduction

The kubectl completion script for Bash can be generated with the command kubectl completion bash. Sourcing the completion script in your shell enables kubectl autocompletion.

Step-by-step Method

Part 1: Install bash-completion

Part 2: Enable kubectl autocompletion

Reference