CLI Pod Creation¶
This page provides a detailed guide on how to create and manage support pods in Kubernetes (K8S) using the command-line interface (CLI)
Step 1: Ensure You Have kubectl Installed¶
Make sure you have kubectl
installed on your machine. You can download it from the Kubernetes website and follow the installation instructions for your operating system.
Step 2: Open a Terminal¶
Open your terminal or command prompt where you can run Kubernetes commands.
Step 3: Connect to Your Kubernetes Cluster¶
Make sure you are connected to your Kubernetes cluster. You can use the following command to check your connection:
If you are not connected, follow the instructions provided by your cluster provider to connect.Step 4: Create a YAML File for the Pod¶
Create a new YAML file named support-pod-node.yaml
with the following content:
apiVersion: v1
kind: Pod
metadata:
name: support-pod-node
namespace: default
spec:
containers:
- name: support-pod-node
image: ubuntu:latest
command:
- "/bin/bash"
- "-c"
- |
apt-get update && \
apt-get install -y netcat-openbsd telnet dnsutils curl iputils-ping git && \
while true; do sleep 3600; done
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
nodeName: aks-nodename-13402868-vmss000003
Step 5: Apply the YAML File to Your Cluster¶
Run the following command to apply the YAML file to your Kubernetes cluster:
This command will create thesupport-pod-node
pod in your cluster.
Step 6: Verify the Pod is Running¶
Check the status of the pod to ensure it is running:
You should see thesupport-pod-node
listed as running.
Step 7: Access the Pod¶
To access the pod and run commands inside it, use the following command:
This command will open an interactive shell inside thesupport-pod-node
pod.
Step 8: Troubleshoot and Support¶
You can now use the pod for troubleshooting and support tasks using the installed utilities like netcat
, telnet
, dnsutils
, curl
, ping
, and git
.