Basic kubectl commands
The following commands should help you get started with Kubernetes and kubectl.
Get information about your cluster
List the resources available in your cluster. More details
Run a container
It’s like docker run
with a little bit different syntax. More details
Get logs from a container
This will output the logs from the container into your terminal. More details
Execute command in container
This executes the env
command in the container and displays the result. More details
Execute interactive shell in the container
This will execute bash
in the container and you’ll be able to type commands interactively from your terminal. More details
Run Kubernetes API proxy
This will run a local HTTP service, which will proxy request to the cluster. Using this service you can access the Kubernetes API, so you can control the cluster using HTTP requests. More details
Apply changes from a file
Describe what needs to be done in a .yaml
file and let Kubernetes do the rest. More details
Delete everything from your cluster
If you no longer need the resources in your cluster you can drop them with this command. More details
Forward a local port to a container in the cluster
Either you expose the container’s port and then you can access it from your local machine or you can use this command to temporarily forward traffic from your local machine to the container. More details
Comments