Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
**/node_modules
**/dist
local/*
.yarn/*
!.yarn/patches
!.yarn/plugins
Expand Down
61 changes: 61 additions & 0 deletions docs/en/ui/cli_tools/ac/ac-and-kubectl-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
weight: 30
---

# Usage of ac and kubectl Commands

The Kubernetes command-line interface (CLI), kubectl, can be used to run commands against a Kubernetes cluster. Because ACP is a Kubernetes-compatible platform, you can use the supported kubectl binaries that ship with ACP CLI, or you can gain extended functionality by using the ac binary.

## The ac Binary

The ac binary offers the same capabilities as the kubectl binary, but extends to natively support additional ACP platform features, including:

### ACP Platform Integration

ACP CLI provides built-in support for ACP's centralized, proxy-based multi-cluster architecture:

- **Platform Authentication** - Built-in login command for secure authentication with ACP platforms
- **Session Management** - Multi-platform session management with commands like `ac login`, `ac config use-session`, and `ac logout`
- **Enhanced Configuration** - Additional commands like `ac config use-cluster` that make it easier to work with ACP multi-cluster environments

### Intelligent Resource Routing

ACP CLI automatically routes platform-level resource types like `User` and `Project` to the global cluster, since these resources only exist at the platform level. This allows you to access them from any cluster context without manual switching. All other resources work normally with your current cluster context.

#### Resource Routing Example

```bash
# Current context points to workload cluster
$ ac config current-context
prod/workload-a

# User requests global resource - ACP CLI automatically routes to global cluster
$ ac get projects
(i) Note: Targeting global cluster for this command only, as 'projects' is a global resource.
NAME STATUS AGE
project-a Active 32d
project-b Active 18d

# User requests workload resource - operates on current cluster
$ ac get pods
NAME READY STATUS RESTARTS AGE
my-app-7d4f8c9b6-xyz123 1/1 Running 0 2h
```

### Additional Commands

ACP CLI includes additional commands that simplify ACP platform workflows:

- `ac login` - Authenticate to ACP platforms and configure multi-cluster access
- `ac logout` - End platform sessions and clean up configuration
- `ac config get-sessions` - List all configured ACP platform sessions
- `ac config use-session <session_name>` - Switch between ACP platforms
- `ac config use-cluster <cluster_name>` - Switch clusters within current session
- `ac namespace` - Enhanced namespace management with platform context display
- `ac config sync` - Synchronize configuration with platform state

## The kubectl Binary

The kubectl binary is provided as a means to support existing workflows and scripts for new ACP CLI users coming from a standard Kubernetes environment, or for those who prefer to use the kubectl CLI. Existing users of kubectl can continue to use the binary to interact with Kubernetes primitives, with no changes required to the ACP platform.

For more information about kubectl, see the [kubectl documentation](https://kubernetes.io/docs/reference/kubectl/).
115 changes: 115 additions & 0 deletions docs/en/ui/cli_tools/ac/administrator-command-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
weight: 70
---

# AC CLI Administrator Command Reference

This reference provides descriptions and example commands for AC CLI administrator commands. You must have cluster-admin or equivalent permissions to use these commands.

For developer commands, see the AC CLI developer command reference.

Run `ac adm -h` to list all administrator commands or run `ac <command> --help` to get additional details for a specific command.


## ac adm

ACP administrative tools for cluster management

### Example usage

```
# Drain a node for maintenance
ac adm drain NODE_NAME

# Cordon a node (mark as unschedulable)
ac adm cordon NODE_NAME

# Uncordon a node (mark as schedulable)
ac adm uncordon NODE_NAME
```

## ac adm certificate

Modify certificate resources

## ac adm certificate approve

Approve a certificate signing request

### Example usage

```
# Approve CSR 'csr-sqgzp'
ac adm certificate approve csr-sqgzp
```

## ac adm certificate deny

Deny a certificate signing request

### Example usage

```
# Deny CSR 'csr-sqgzp'
ac adm certificate deny csr-sqgzp
```

## ac adm cordon

Mark node as unschedulable

### Example usage

```
# Mark node "foo" as unschedulable
ac adm cordon foo
```

## ac adm drain

Drain node in preparation for maintenance

### Example usage

```
# Drain node "foo", even if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set on it
ac adm drain foo --force

# As above, but abort if there are pods not managed by a replication controller, replica set, job, daemon set, or stateful set, and use a grace period of 15 minutes
ac adm drain foo --grace-period=900
```

## ac adm taint

Update the taints on one or more nodes

### Example usage

```
# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'
# If a taint with that key and effect already exists, its value is replaced as specified
ac adm taint nodes foo dedicated=special-user:NoSchedule

# Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists
ac adm taint nodes foo dedicated:NoSchedule-

# Remove from node 'foo' all the taints with key 'dedicated'
ac adm taint nodes foo dedicated-

# Add a taint with key 'dedicated' on nodes having label myLabel=X
ac adm taint node -l myLabel=X dedicated=foo:PreferNoSchedule

# Add to node 'foo' a taint with key 'bar' and no value
ac adm taint nodes foo bar:NoSchedule
```

## ac adm uncordon

Mark node as schedulable

### Example usage

```
# Mark node "foo" as schedulable
ac adm uncordon foo
```
118 changes: 118 additions & 0 deletions docs/en/ui/cli_tools/ac/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
weight: 20
---

# Configuring ACP CLI

## Shell Completion

You can enable tab completion for the Bash or Zsh shells.

### Enabling Tab Completion for Bash

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.

#### Prerequisites

- You must have ACP CLI (ac) installed.
- You must have the package bash-completion installed.

#### Procedure

1. Save the Bash completion code to a file:
```bash
$ ac completion bash > ac_bash_completion
```

2. Copy the file to `/etc/bash_completion.d/`:
```bash
$ sudo cp ac_bash_completion /etc/bash_completion.d/
```

You can also save the file to a local directory and source it from your .bashrc file instead.

Tab completion is enabled when you open a new terminal.

### Enabling Tab Completion for Zsh

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.

#### Prerequisites

You must have ACP CLI (ac) installed.

#### Procedure

To add tab completion for ac to your .zshrc file, run the following command:

```bash
cat >>~/.zshrc<<EOF
autoload -Uz compinit
compinit
if [[ $commands[ac] ]]; then
source <(ac completion zsh)
compdef _ac ac
fi
EOF
```

Tab completion is enabled when you open a new terminal.

## Accessing kubeconfig by using ACP CLI

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.

### Prerequisites

You have access to an ACP platform endpoint and valid authentication credentials.

### Procedure

1. Log in to your ACP platform by running the following command:
```bash
$ ac login <platform-url> --name <session-name>
```

- `<platform-url>`: The base URL of the ACP platform (e.g., https://acp.prod.example.com)
- `<session-name>`: A user-defined friendly name for this platform connection (e.g., "prod", "staging")

2. The login process automatically:
- Authenticates with the ACP platform
- Discovers all accessible clusters in the platform
- Creates kubeconfig entries for all clusters with ACP-specific metadata
- Sets up a default context pointing to the global cluster

3. To export the configuration to a separate file, run:
```bash
$ ac config view --raw > kubeconfig
```

4. Set the KUBECONFIG environment variable to point to the exported file:
```bash
$ export KUBECONFIG=./kubeconfig
```

5. Use ac to interact with your ACP clusters:
```bash
$ ac get nodes
```

### Multi-Cluster Configuration Handling

ACP CLI login process creates a comprehensive kubeconfig structure that includes:

- **Multiple cluster entries**: One for each accessible cluster in the platform
- **Session metadata**: Platform URL, session name, and cluster descriptions stored in extension fields
- **Unified authentication**: Single user credential entry that works across all clusters in the platform
- **Intelligent naming**: Conflict-free naming conventions using `acp:<session>:<cluster>` format

### Security Considerations

**Important**: The exported kubeconfig file contains authentication tokens that provide access to your ACP platform clusters.

- Store the file securely with appropriate file permissions
- Never commit kubeconfig files to version control systems
- Consider the token expiration and refresh requirements
- Use different session names for different environments (prod, staging, dev) to maintain clear separation

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.
Loading