|
| 1 | +--- |
| 2 | +weight: 20 |
| 3 | +--- |
| 4 | + |
| 5 | +# Configuring ACP CLI |
| 6 | + |
| 7 | +## Shell Completion |
| 8 | + |
| 9 | +You can enable tab completion for the Bash or Zsh shells. |
| 10 | + |
| 11 | +### Enabling Tab Completion for Bash |
| 12 | + |
| 13 | +After you install ACP CLI (ac), you can enable tab completion to automatically complete ac commands or suggest options when you press Tab. The following procedure enables tab completion for the Bash shell. |
| 14 | + |
| 15 | +#### Prerequisites |
| 16 | + |
| 17 | +- You must have ACP CLI (ac) installed. |
| 18 | +- You must have the package bash-completion installed. |
| 19 | + |
| 20 | +#### Procedure |
| 21 | + |
| 22 | +1. Save the Bash completion code to a file: |
| 23 | + ```bash |
| 24 | + $ ac completion bash > ac_bash_completion |
| 25 | + ``` |
| 26 | + |
| 27 | +2. Copy the file to `/etc/bash_completion.d/`: |
| 28 | + ```bash |
| 29 | + $ sudo cp ac_bash_completion /etc/bash_completion.d/ |
| 30 | + ``` |
| 31 | + |
| 32 | + You can also save the file to a local directory and source it from your .bashrc file instead. |
| 33 | + |
| 34 | +Tab completion is enabled when you open a new terminal. |
| 35 | + |
| 36 | +### Enabling Tab Completion for Zsh |
| 37 | + |
| 38 | +After you install ACP CLI (ac), you can enable tab completion to automatically complete ac commands or suggest options when you press Tab. The following procedure enables tab completion for the Zsh shell. |
| 39 | + |
| 40 | +#### Prerequisites |
| 41 | + |
| 42 | +You must have ACP CLI (ac) installed. |
| 43 | + |
| 44 | +#### Procedure |
| 45 | + |
| 46 | +To add tab completion for ac to your .zshrc file, run the following command: |
| 47 | + |
| 48 | +```bash |
| 49 | +cat >>~/.zshrc<<EOF |
| 50 | +autoload -Uz compinit |
| 51 | +compinit |
| 52 | +if [[ $commands[ac] ]]; then |
| 53 | + source <(ac completion zsh) |
| 54 | + compdef _ac ac |
| 55 | +fi |
| 56 | +EOF |
| 57 | +``` |
| 58 | + |
| 59 | +Tab completion is enabled when you open a new terminal. |
| 60 | + |
| 61 | +## Accessing kubeconfig by using ACP CLI |
| 62 | + |
| 63 | +You can use ACP CLI (ac) to log in to your ACP platform and retrieve a kubeconfig file for accessing clusters from the command line. Unlike traditional single-cluster kubeconfig exports, ac login creates a comprehensive multi-cluster configuration through platform discovery. |
| 64 | + |
| 65 | +### Prerequisites |
| 66 | + |
| 67 | +You have access to an ACP platform endpoint and valid authentication credentials. |
| 68 | + |
| 69 | +### Procedure |
| 70 | + |
| 71 | +1. Log in to your ACP platform by running the following command: |
| 72 | + ```bash |
| 73 | + $ ac login <platform-url> --name <session-name> |
| 74 | + ``` |
| 75 | + |
| 76 | + - `<platform-url>`: The base URL of the ACP platform (e.g., https://acp.prod.example.com) |
| 77 | + - `<session-name>`: A user-defined friendly name for this platform connection (e.g., "prod", "staging") |
| 78 | + |
| 79 | +2. The login process automatically: |
| 80 | + - Authenticates with the ACP platform |
| 81 | + - Discovers all accessible clusters in the platform |
| 82 | + - Creates kubeconfig entries for all clusters with ACP-specific metadata |
| 83 | + - Sets up a default context pointing to the global cluster |
| 84 | + |
| 85 | +3. To export the configuration to a separate file, run: |
| 86 | + ```bash |
| 87 | + $ ac config view --raw > kubeconfig |
| 88 | + ``` |
| 89 | + |
| 90 | +4. Set the KUBECONFIG environment variable to point to the exported file: |
| 91 | + ```bash |
| 92 | + $ export KUBECONFIG=./kubeconfig |
| 93 | + ``` |
| 94 | + |
| 95 | +5. Use ac to interact with your ACP clusters: |
| 96 | + ```bash |
| 97 | + $ ac get nodes |
| 98 | + ``` |
| 99 | + |
| 100 | +### Multi-Cluster Configuration Handling |
| 101 | + |
| 102 | +ACP CLI login process creates a comprehensive kubeconfig structure that includes: |
| 103 | + |
| 104 | +- **Multiple cluster entries**: One for each accessible cluster in the platform |
| 105 | +- **Session metadata**: Platform URL, session name, and cluster descriptions stored in extension fields |
| 106 | +- **Unified authentication**: Single user credential entry that works across all clusters in the platform |
| 107 | +- **Intelligent naming**: Conflict-free naming conventions using `acp:<session>:<cluster>` format |
| 108 | + |
| 109 | +### Security Considerations |
| 110 | + |
| 111 | +**Important**: The exported kubeconfig file contains authentication tokens that provide access to your ACP platform clusters. |
| 112 | + |
| 113 | +- Store the file securely with appropriate file permissions |
| 114 | +- Never commit kubeconfig files to version control systems |
| 115 | +- Consider the token expiration and refresh requirements |
| 116 | +- Use different session names for different environments (prod, staging, dev) to maintain clear separation |
| 117 | + |
| 118 | +If you plan to reuse the exported kubeconfig file across sessions or machines, ensure it is stored securely and regularly synchronized with `ac config sync` to maintain current cluster lists. |
0 commit comments