> ## Documentation Index
> Fetch the complete documentation index at: https://aletyx.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloud Command Line Tools in Aletyx Enterprise Build of Kogito and Drools 10.1.0-aletyx

> Install and configure the Kubernetes CLI (kubectl) and Red Hat OpenShift CLI (oc) for Aletyx Enterprise Build of Kogito and Drools.

## Kubernetes CLI (Kubectl)

<Tabs>
  <Tab title="MacOS">
    1. Using Homebrew (recommended):

       ```sh theme={null}
       brew install kubectl
       ```

    2. Manual installation:

       ```sh theme={null}
       Download kubectl
       curl -LO "https://dl.k8s.io/release/v1.29.2/bin/darwin/arm64/kubectl"
       ```

    3. Make kubectl executable

       ```sh theme={null}
       chmod +x ./kubectl
       ```

    4. Move kubectl to a directory in your PATH

       ```sh theme={null}
       sudo mv ./kubectl /usr/local/bin/kubectl
       ```
  </Tab>

  <Tab title="Linux">
    1. Using package manager (Ubuntu/Debian):

       ```sh theme={null}
       # Add Kubernetes apt repository
       sudo apt-get update
       sudo apt-get install -y apt-transport-https ca-certificates curl
       curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
       echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
       sudo apt-get update
       sudo apt-get install -y kubectl
       ```

    2. Manual installation:

       ```sh theme={null}
       # Download kubectl
       curl -LO "https://dl.k8s.io/release/v1.29.2/bin/linux/amd64/kubectl"
       ```

    3. Make kubectl executable

       ```sh theme={null}
       chmod +x ./kubectl
       ```

       Move kubectl to a directory in your PATH

       ```sh theme={null}
       sudo mv ./kubectl /usr/local/bin/kubectl
       ```
  </Tab>

  <Tab title="Microsoft Windows">
    1. Using Chocolatey® (recommended):

       ```powershell theme={null}
       choco install kubernetes-cli
       ```

    2. Manual installation:

       ```powershell theme={null}
       # Create directory for kubectl
       New-Item -Path 'C:\Program Files\kubectl' -Type Directory
       ```

    3. Download kubectl

       ```powershell theme={null}
       curl.exe -LO "https://dl.k8s.io/release/v1.29.2/bin/windows/amd64/kubectl.exe"
       ```

    4. Move kubectl to the created directory

       ```powershell theme={null}
       Move-Item .\kubectl.exe 'C:\Program Files\kubectl\'
       ```

    5. Add to PATH

       ```powershell theme={null}
       $env:Path += ";C:\Program Files\kubectl"
       [Environment]::SetEnvironmentVariable(
           "Path",
           [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine) + ";C:\Program Files\kubectl",
           [System.EnvironmentVariableTarget]::Machine)
       ```
  </Tab>
</Tabs>

## Red Hat OpenShift® CLI (oc)

<Tabs>
  <Tab title="Windows">
    1. Using web console:
       * Log into your OpenShift web console
       * Click ? icon in the top right
       * Select "Command Line Tools"
       * Download Windows oc client
       * Extract the archive

    2. Create directory for OpenShift CLI

       ```powershell theme={null}
       New-Item -Path 'C:\Program Files\OpenShift' -Type Directory
       ```

    3. Move oc.exe to the created directory

       ```powershell theme={null}
       Move-Item .\oc.exe 'C:\Program Files\OpenShift\'
       ```

    4. Add to PATH

       ```powershell theme={null}
       $env:Path += ";C:\Program Files\OpenShift"
       [Environment]::SetEnvironmentVariable(
       "Path",
       [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine) + ";C:\Program Files\OpenShift",
       [System.EnvironmentVariableTarget]::Machine)
       ```
  </Tab>

  <Tab title="macOS">
    1. Using Homebrew:

       ```sh theme={null}
       brew install openshift-cli
       ```

    2. Manual installation:

       * Log into your OpenShift web console
       * Click ? icon in the top right
       * Select "Command Line Tools"
       * Download macOS oc client
       * Extract the downloaded archive

         ```sh theme={null}
         # Extract the downloaded archive
         tar xvf oc.tar.gz

         # Make oc executable
         chmod +x ./oc

         # Move to a directory in your PATH
         sudo mv ./oc /usr/local/bin/oc
         ```
  </Tab>

  <Tab title="Linux">
    1. Manual installation:

    * Log into your OpenShift web console
    * Click ? icon in the top right
    * Select "Command Line Tools"
    * Download Linux oc client
    * Extract the downloaded archive

    ```sh theme={null}
    # Extract the downloaded archive
    tar xvf oc.tar.gz

    # Make oc executable
    chmod +x ./oc

    # Move to a directory in your PATH
    sudo mv ./oc /usr/local/bin/oc
    ```
  </Tab>
</Tabs>

## Verification and Configuration

Verify the installations:

```sh theme={null}
# Verify kubectl
kubectl version --client

# Verify oc
oc version --client
```

### kubectl Configuration

```sh theme={null}
# Create kubectl config directory if it doesn't exist
mkdir -p ~/.kube

# Set KUBECONFIG environment variable
export KUBECONFIG=~/.kube/config
```

### Red Hat OpenShift Login

```sh theme={null}
# Login to OpenShift cluster
oc login --token=<token> --server=https://api.cluster-url:6443

# View available projects
oc projects

# Switch to a specific project
oc project <project-name>
```

<Tip>
  Store your OpenShift login token securely. You can get a new token from the OpenShift web console under your profile → Copy login command.
</Tip>

## Shell Completion

<Tabs>
  <Tab title="Bash">
    ```sh theme={null}
    # kubectl completion
    echo 'source <(kubectl completion bash)' >>~/.bashrc

    # oc completion
    echo 'source <(oc completion bash)' >>~/.bashrc
    ```
  </Tab>

  <Tab title="Zsh">
    ```sh theme={null}
    # kubectl completion
    echo '[[$commands[kubectl]]] && source <(kubectl completion zsh)' >>~/.zshrc

    # oc completion
    echo '[[ $commands[oc] ]] && source <(oc completion zsh)' >>~/.zshrc
    ```
  </Tab>

  <Tab title="PowerShell">
    ```powershell theme={null}
    # kubectl completion
    kubectl completion powershell | Out-String | Invoke-Expression

    # oc completion
    oc completion powershell | Out-String | Invoke-Expression
    ```
  </Tab>
</Tabs>

## Common Issues and Troubleshooting

<Warning>
  If you're behind a corporate proxy, you might need to configure proxy settings for both kubectl and oc.
</Warning>

Common troubleshooting steps:

```sh theme={null}
# Check kubectl context
kubectl config current-context

# Check oc login status
oc whoami

# View cluster info
kubectl cluster-info
oc cluster-info

# Check connection to cluster
kubectl get nodes
oc get nodes
```

<Tip>
  Keep your CLI tools up to date with the cluster version to avoid compatibility issues. You can check the required versions in your cluster's documentation.
</Tip>
