prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Forward local port 3000 to pod port 8088 | Command:
```bash
kubectl port-forward pod/backend-pod 3000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Output the modified 'cache-cluster-deployment' deployment in YAML format, without making any changes to the object on the server | Command:
```bash
kubectl set env deployment/cache-cluster-deployment ENV=prod -o yaml
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod template... |
Create a secret named api-secret-key and populate it with keys for each file in the specified path | Command:
```bash
kubectl create secret generic api-secret-key --from-file=path/to/preferences
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename o... |
Create a deployment named 'db' with the 'ruby' image and expose port 3000 | Command:
```bash
kubectl create deployment db --image=ruby --port=3000
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|ya... |
Create a job named "backup" using the "wordpress" image and run the command "apache2ctl -D FOREGROUND" | Command:
```bash
kubectl create job backup --image=wordpress -- apache2ctl -D FOREGROUND
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Create a job named security-scan-job with the postgres image, and run the command "pg_dump --version" inside the container | Command:
```bash
kubectl create job security-scan-job --image=postgres -- pg_dump --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "O... |
Get the output from running the 'docker run ubuntu echo "Hello, World"' command from the pod named security-service-pod, using the first container by default | Command:
```bash
kubectl exec security-service-pod -- docker run ubuntu echo "Hello, World"
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container ... |
Set the service account of the deployment "proxy-service-deployment" to "jenkins" | Command:
```bash
kubectl set serviceaccount deployment proxy-service-deployment jenkins
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kube... |
Get the output from running the 'dotnet' command in the nano-bot container of the email-service-pod pod. | Command:
```bash
kubectl exec email-service-pod -c nano-bot -- dotnet
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use ... |
Add the label 'tier' with the value 'database' to the pod 'auth' | Command:
```bash
kubectl label pods auth tier=database
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If... |
Remove the label 'unhealthy' from the pod named 'web' | Command:
```bash
kubectl label pods web unhealthy-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If tru... |
Check if I have permission to list the job named "deploy-artifacts-job" in namespace "namespace-1" | Command:
```bash
kubectl auth can-i list jobs.batch/deploy-artifacts-job -n namespace-1
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a parti... |
Create a debug container from mypod with all container images changed to nginx. | Command:
```bash
kubectl debug mypod --copy-to=debug-image-memcached --set-image=*=nginx
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resou... |
Forward local port 8000 to port 3000 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 8000 3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Update the label of the 'api' pod to 'release=v1.0' | Command:
```bash
kubectl label pods api release=v1.0
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If t... |
Start the hazelcast pod with custom arguments for the default command | Command:
```bash
kubectl run nginx --image=hazelcast/hazelcast -- <arg1> <arg2> ... <argN>
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
He... |
Execute the 'bash' command in the container 'lunar-launcher' running in the pod 'cdn-service-pod' and retrieve the output. | Command:
```bash
kubectl exec cdn-service-pod -c lunar-launcher -- bash
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Create a service for the replicated 'wordpress' using replica set, which will serve on port 3001 and connect to the containers on port 8000 | Command:
```bash
kubectl expose rs wordpress --port=3001 --target-port=8000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port... |
Auto scale the "media-stream" replication controller with a maximum of 3 pods, and a target CPU utilization of 60%. | Command:
```bash
kubectl autoscale rc media-stream --max=3 --cpu-percent=60
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that... |
Create a new NodePort service named 'analytics-nodeport' and map the container port 9000 to the NodePort port 8089. | Command:
```bash
kubectl create service nodeport analytics-nodeport --tcp=8089:9000
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Update the image of the 'wordpress' container to 'wordpress:5.8.1' for all deployments and replication controllers. | Command:
```bash
kubectl set image deployments,rc wordpress=wordpress:5.8.1 --all
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)... |
Get the output of the `node --version` command running in the `quantum-quark` container within the `vpn-service-pod` pod. | Command:
```bash
kubectl exec vpn-service-pod -c quantum-quark -- node --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If om... |
Copy the file /tmp/foo from the remote pod argocd/cache-pod-5 to the local directory /tmp/bar_dir | Command:
```bash
kubectl cp argocd/cache-pod-5:/tmp/foo /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kub... |
Create a new secret named aws-credentials-secret using an environment file | Command:
```bash
kubectl create secret generic aws-credentials-secret --from-env-file=path/to/preferences.env
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default t... |
Import specific keys from a config map into environment variables for a deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-name-config deployment/database-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
View detailed information about pods with the label "team=devops" | Command:
```bash
kubectl describe po -l team=devops
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a... |
Get the output from running the 'geth' command in the quantum-quark container of the pod named proxy-service-pod. | Command:
```bash
kubectl exec proxy-service-pod -c quantum-quark -- geth
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Update the image of all containers in the daemonset named 'staging' to 'golang:1.17' | Command:
```bash
kubectl set image daemonset staging *=golang:1.17
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`kube... |
Get the output from running the 'docker run -d ubuntu sleep 3600' command in the stardust-shuttle container of the 'frontend-pod' pod. | Command:
```bash
kubectl exec frontend-pod -c stardust-shuttle -- docker run -d ubuntu sleep 3600
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Cont... |
Set the custom TLS server name to "galaxy-cluster" for the "my-k8s-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=galaxy-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifi... |
Add an annotation to the 'security' pod with the key 'release-notes' and the value 'https://example.com/release-notes/v2.5.1' | Command:
```bash
kubectl annotate pods security release-notes='https://example.com/release-notes/v2.5.1'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be lar... |
Create an ingress called 'website-ingress' that directs requests from 'foo.com/input' to the service 'svc1' on port '8888', with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="foo.com/input=svc1:8888,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
List the pod specified in the "conf.yaml" file using YAML output format. | Command:
```bash
kubectl get -f conf.yaml -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see results... |
Update the pod 'foo' by adding or overwriting the annotation 'team' with the value 'frontend-team'. | Command:
```bash
kubectl annotate --overwrite pods foo team='frontend-team'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include a... |
Execute the 'kafka-server-start /etc/kafka/server.properties' command inside the 'time-machine' container in the 'frontend-pod' pod and get the output. | Command:
```bash
kubectl exec frontend-pod -c time-machine -- kafka-server-start /etc/kafka/server.properties
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "u... |
Create a job named "log-collection" using the "wordpress" image, with the command "apache2ctl -D FOREGROUND" | Command:
```bash
kubectl create job log-collection --image=wordpress -- apache2ctl -D FOREGROUND
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Update the environment variable 'DB_USER' of the deployment 'backend-microservice-deployment' | Command:
```bash
kubectl set env deployment/backend-microservice-deployment DB_USER=username
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod t... |
Import the environment variables starting with MYSQL_ from the config map named app-name-config and set them as environment variables for the authentication-service-deployment. | Command:
```bash
kubectl set env --from=configmap/app-name-config --prefix=MYSQL_ deployment/authentication-service-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
Set the custom TLS server name to 'my-k8s-cluster' for the 'on-prem-cluster' cluster entry. | Command:
```bash
kubectl config set-cluster on-prem-cluster --tls-server-name=my-k8s-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certif... |
Create a deployment named "loadbalancer" using the "ethereum/client-go" image and expose port 8084. | Command:
```bash
kubectl create deployment loadbalancer --image=ethereum/client-go --port=8084
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output... |
Create a new config map named log-config using the settings files located in the path/to/settings folder | Command:
```bash
kubectl create configmap log-config --from-file=path/to/settings
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basename o... |
Create a copy of the gateway-pod, changing all container images to busybox | Command:
```bash
kubectl debug gateway-pod --copy-to=my-debugger --set-image=*=busybox
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resourc... |
Import specific keys from a config map for a deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-config-prod deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable def... |
Get the output from running the 'python --version' command in the 'rocket-ranger' container from the 'cdn-service-pod' pod. | Command:
```bash
kubectl exec cdn-service-pod -c rocket-ranger -- python --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If ... |
Open the user-service service for editing using the Atom editor. | Command:
```bash
KUBE_EDITOR="atom" kubectl edit svc/user-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, o... |
Scale the deployment named backend-service-replicaset to 3 replicas if its current size is 1. | Command:
```bash
kubectl scale --current-replicas=1 --replicas=3 deployment/backend-service-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --r... |
Create a new config map named kube-system-config in the default namespace with two keys: 'conf' and 'data' | Command:
```bash
kubectl create configmap kube-system-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creati... |
Set the service account of the deployment "database-deployment" to "istio" | Command:
```bash
kubectl set serviceaccount deployment database-deployment istio
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kubectl set... |
Display the snapshot logs from the first container of the 'virus-scan-job' job. | Command:
```bash
kubectl logs job/virus-scan-job
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short": "-c", "... |
Set up port forwarding to forward traffic from local port 8000 to port 8080 in the chat-app-pod | Command:
```bash
kubectl port-forward pod/chat-app-pod 8000 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Remove the taint with key 'dedicated' and effect 'NoSchedule' from node 'prod-node-5' if it exists. | Command:
```bash
kubectl taint nodes prod-node-5 dedicated:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Forward local traffic on port 8088 to port 5000 in the 'api-service-pod' pod | Command:
```bash
kubectl port-forward pod/api-service-pod 8088 5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Copy the local file `/tmp/foo` to the `/etc/kubernetes` directory inside the `monitoring-agent-pod-6` pod in the `prometheus` namespace. | Command:
```bash
kubectl cp :/tmp/foo prometheus/monitoring-agent-pod-6:/etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Add the specific keys 'database_url' from the 'global-config' config map to the environment variables for the 'scheduler-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/global-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Connect to the interactive terminal of the 'email-service-pod' container named 'cyber-sleuth' and communicate with it in real-time. | Command:
```bash
kubectl attach email-service-pod -c cyber-sleuth -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If ... |
Create a new ExternalName service named external-file-storage-service with an external name of practice-online.site | Command:
```bash
kubectl create service externalname external-file-storage-service --external-name practice-online.site
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to refe... |
Update the cluster field in the context named "my-context" to "kube-cluster-2" | Command:
```bash
kubectl config set contexts.cluster-1-context.cluster kube-cluster-2
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value ... |
Update a specific container in a node, by specifying the patch in YAML format | Command:
```bash
kubectl patch node monitoring-node-15 -p $'spec:\n containers:\n- name: container-name\n resources:\n limits:\n cpu: 200m'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patc... |
Set the custom TLS server name to 'kube-cluster-2' for the 'staging-cluster' cluster entry | Command:
```bash
kubectl config set-cluster staging-cluster --tls-server-name=kube-cluster-2
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certif... |
Create an autoscaling configuration for the replication controller "frontend" | Command:
```bash
kubectl autoscale rc frontend --max=6 --cpu-percent=81
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that use... |
update the client-key field for the dev-user entry in the kubeconfig file without modifying any other values. | Command:
```bash
kubectl config set-credentials dev-user --client-key=~/.kube/admin.key
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token fl... |
Execute the 'wp' command in the 'cosmic-container' container from the 'email-service-pod' pod and display the output. | Command:
```bash
kubectl exec email-service-pod -c cosmic-container -- wp
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, ... |
Set the CPU limits of the PHP container to "500m" and the memory limits to "128Mi" in the nginx container of the php deployment. | Command:
```bash
kubectl set resources deployment php -c=nginx --limits=cpu=500m,memory=128Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to i... |
Add label "release=v2.0" to pod "database" | Command:
```bash
kubectl label pods database release=v2.0
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": ... |
Add a taint with the key 'app' on nodes that have the label 'region' with the value 'eu-west-2' | Command:
```bash
kubectl taint node -l region=eu-west-2 app=web-node-8:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Out... |
Remove the label 'tier' from the pod 'api' | Command:
```bash
kubectl label pods api tier-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If true, ch... |
Execute the 'dotnet' command inside the first container of the 'load-balancer-deployment' deployment and retrieve the output. | Command:
```bash
kubectl exec deploy/load-balancer-deployment -- dotnet
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Update the label of the pod 'log-aggregator' to include the label 'component' with the value 'api' | Command:
```bash
kubectl label pods log-aggregator component=api
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "u... |
Delete the pods and services with the names "vpn" and "log-aggregator" | Command:
```bash
kubectl delete pod,service vpn log-aggregator
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label select... |
Get the output from running the 'npm --version' command in the nebula-navigator container inside the media-stream-pod pod. | Command:
```bash
kubectl exec media-stream-pod -c nebula-navigator -- npm --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If... |
Create a deployment named "api" with the "ruby" image and 4 replicas. | Command:
```bash
kubectl create deployment api --image=ruby --replicas=4
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|... |
Retrieve the output of the 'elasticsearch-plugin --list' command from the 'time-machine' container within the 'frontend-pod' pod. | Command:
```bash
kubectl exec frontend-pod -c time-machine -- elasticsearch-plugin --list
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container na... |
Get the output from running the 'jenkins-plugin-cli' command in the stardust-shuttle container within the proxy-server-pod pod | Command:
```bash
kubectl exec proxy-server-pod -c stardust-shuttle -- jenkins-plugin-cli
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container nam... |
Create a cluster role named "default_role" with the ability to get services and specific resource names like load-balancer and machine-learning. | Command:
```bash
kubectl create clusterrole default_role --verb=get --resource=services --resource-name=load-balancer --resource-name=machine-learning
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=serve... |
Set the service account of the deployment named database-deployment to elasticsearch | Command:
```bash
kubectl set serviceaccount deployment database-deployment elasticsearch
```
What it does:
Update the service account of pod template resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
Syntax:
`kub... |
Create a service named "frontend" to expose the pod "web-app-pod" on port 444. | Command:
```bash
kubectl expose pod web-app-pod --port=8181 --name=frontend
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port... |
Set the custom TLS server name to "star-cluster" for the kube-cluster-2 cluster entry. | Command:
```bash
kubectl config set-cluster kube-cluster-2 --tls-server-name=star-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certifica... |
Set the cluster field of the 'admin-context' context to 'my-k8s-cluster' | Command:
```bash
kubectl config set contexts.admin-context.cluster my-k8s-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you ... |
Forward traffic from local port 8088 to port 8000 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 8088:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Import the LOG_LEVEL key from the config map 'namespace-config' into the deployment 'load-balancer-deployment' | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/namespace-config deployment/load-balancer-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Start a new node pod named 'hazelcast' using the 'node' image, and let the container expose port 8888. | Command:
```bash
kubectl run hazelcast --image=node --port=8888
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fil... |
Create a new config map named app-config-prod with specific keys and values from files | Command:
```bash
kubectl create configmap app-config-prod --from-file=properties=/path/to/configurations/file1.txt --from-file=key1=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
Wh... |
Create a deployment named api with the golang image and expose port 8181 | Command:
```bash
kubectl create deployment api --image=golang --port=8181
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json... |
Create an ingress with a specific routing rule and TLS secret | Command:
```bash
kubectl create ingress rontend-ingress --rule="site.com/module=svc1:8000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usag... |
start a pod named hazelcast with the centos image, and expose port 9090 | Command:
```bash
kubectl run hazelcast --image=centos --port=9090
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
Open the `search-service` service for editing using the Sublime Text editor. | Command:
```bash
KUBE_EDITOR="sublime" kubectl edit svc/search-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variabl... |
Update the pod specified in the "pod.json" file by adding the annotation "scaling-policy=auto-horizontal-scaling" | Command:
```bash
kubectl annotate -f pod.json scaling-policy=auto-horizontal-scaling
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and ... |
List all allowed actions in the "logging" namespace | Command:
```bash
kubectl auth can-i --list --namespace=logging
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial URL that starts with "... |
Import the api_key from the app-config config map and set it as an environment variable in the user-management-deployment deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-config deployment/user-management-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Create a service for the 'hazelcast' deployment, which serves on port 3001 and connects to the containers on port 909200 | Command:
```bash
kubectl expose deployment hazelcast --port=3001 --target-port=909200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the spec... |
Set the client-key field for the web-app entry in the kubeconfig file, without modifying any other values. | Command:
```bash
kubectl config set-credentials web-app --client-key=~/.kube/admin.key
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token fla... |
Copy the file /tmp/foo from the remote pod named admin-dashboard-pod-16 in the default namespace to the local machine's /tmp/bar directory. | Command:
```bash
kubectl cp default/admin-dashboard-pod-16:/tmp/foo :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the ku... |
Set the cluster field in the user-b-context context to app-cluster | Command:
```bash
kubectl config set contexts.user-b-context.cluster app-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you wa... |
Create a job named 'backup' with the 'postgres' image and the command 'psql' | Command:
```bash
kubectl create job backup --image=postgres -- psql
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: js... |
Create a single ingress called 'app-ingress' that directs requests to 'site.com/input' to the service 'svc1' on port 9091, using the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress app-ingress --rule="site.com/input=svc1:9091,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Start an alpine pod and allow the container to expose port 9000 | Command:
```bash
kubectl run hazelcast --image=alpine --port=9000
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--f... |
Switch to raw terminal mode with the payment-gateway-pod, specifically to the lunar-launcher container | Command:
```bash
kubectl attach payment-gateway-pod -c lunar-launcher -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name.... |
View the snapshot logs from the container "auth-service-pod-1" of the deployment named "order-processing-deployment". | Command:
```bash
kubectl logs deployment/order-processing-deployment -c auth-service-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flag... |
Forward port 5432 on all addresses to port 5432 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 5432:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Add a taint with key 'environment' on nodes having label feature=feature-xyz | Command:
```bash
kubectl taint node -l feature=feature-xyz environment=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.