
Before you can run commands like kubectl get nodes
, you need to install the Kubernetes CLI (kubectl
) and configure it to access your DigitalOcean Kubernetes cluster.
Let me walk you through the steps:
Step 1: Install kubectl
kubectl
is the command-line tool for interacting with Kubernetes clusters. Here’s how to install it:
On Linux:
- Download the latest version of
kubectl
:curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- Make the binary executable:
chmod +x kubectl
- Move it to a directory in your PATH (e.g.,
/usr/local/bin
):sudo mv kubectl /usr/local/bin/
On macOS:
- Use Homebrew to install
kubectl
:brew install kubectl
On Windows:
- Download the latest version of
kubectl
from the official Kubernetes release page. - Add the binary to your system PATH.
Step 2: Install doctl
(DigitalOcean CLI)
doctl
is the official DigitalOcean CLI tool, which makes it easy to manage your Kubernetes cluster and download the kubeconfig file.
On Linux/macOS:
- Download and install
doctl
:brew install doctl
On Windows:
- Download the binary from the DigitalOcean GitHub releases page.
- Add it to your system PATH.
Step 3: Authenticate doctl
- Authenticate
doctl
with your DigitalOcean account:doctl auth init
This will prompt you to enter your DigitalOcean API token. You can generate a token from the DigitalOcean dashboard under API > Tokens/Keys.
Step 4: Download the kubeconfig File
- Use
doctl
to download the kubeconfig file for your cluster:doctl kubernetes cluster kubeconfig save <cluster-name>
Replace
<cluster-name>
with the name of your Kubernetes cluster. - Verify that the kubeconfig file has been added:
kubectl config get-contexts
You should see your DigitalOcean cluster listed.
Step 5: Verify Access to the Cluster
Now that kubectl
is installed and configured, you can verify access to your cluster:
kubectl get nodes
This command should list the nodes in your Kubernetes cluster. If it works, you’re all set to start deploying your applications!
Step 6: Optional – Set the KUBECONFIG
Environment Variable
If you have multiple kubeconfig files or want to specify the path to your kubeconfig file explicitly, you can set the KUBECONFIG
environment variable:
export KUBECONFIG=~/path/to/kubeconfig.yaml
Summary
- Install
kubectl
. - Install
doctl
. - Authenticate
doctl
with your DigitalOcean account. - Download the kubeconfig file for your cluster.
- Verify access using
kubectl get nodes
.
Once you’ve completed these steps, you’re ready to start deploying your Docker containers (SuiteCRM, n8n, and Supabase) to your Kubernetes cluster! 😊
#Kubernetes #DigitalOcean #DevOps #CloudComputing #kubectl #doctl #ContainerOrchestration #Docker #CloudInfrastructure #TechTutorial #Linux #macOS #Windows #Homebrew #CloudAutomation #TechTips #K8s #CloudCLI #DeveloperTools #InfrastructureAsCode