"root" user fails to run "kubectl" commands in SSH session of VCF Automation 9.0
search cancel

"root" user fails to run "kubectl" commands in SSH session of VCF Automation 9.0

book

Article ID: 436828

calendar_today

Updated On:

Products

VCF Automation

Issue/Introduction

When logged into an SSH session of VCF Automation 9.0, the "root" user is unable to run any kubectl commands, encounters a connection or command not found error when attempting to execute standard Kubernetes operations:

Environment

VCF Automation 9.X

Cause

The Kubernetes configuration is not automatically imported because the kubectl command environment variables are not initialized for the "root" user profile by default.

Resolution

Follow these steps to initialize the environment and resolve the issue:

  1. SSH into the VCF Automation 9.x appliance as the vmware-system-user.

  2. Switch to the root user by running the following command:

    sudo -su root
    
  3. Export the Kubernetes configuration by running:

    export KUBECONFIG=/etc/kubernetes/admin.conf
    

  4. Once the command is executed successfully, kubectl commands run successfully: