prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new config map named app-secrets, using the files in the folder path/to/profiles. | Command:
```bash
kubectl create configmap app-secrets --from-file=path/to/profiles
```
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 ... |
Add a taint with the key 'workload' on nodes that have the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend workload=k8s-node-1: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": "O... |
Open an interactive terminal session with the cyber-sleuth container in the database-pod, allowing you to send commands to the terminal and receive the outputs. | Command:
```bash
kubectl attach database-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 omitt... |
Listen on port 5432 on all addresses and forward the traffic to port 8000 in the 'mypod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 5432: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 sel... |
Forward local port 8081 to port 9090 in the analytics-pod pod | Command:
```bash
kubectl port-forward pod/analytics-pod 8081 9090
```
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 auto... |
Create a pod disruption budget called ingress-controller-pdb that will select all pods with the component=web label and ensure that at least four of them are always available. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=component=web --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-avail... |
Retrieve a list of deployments in the JSON output format for the "hotfix-1.1.2" version of the "custom-deployments" API group. | Command:
```bash
kubectl get deployments.hotfix-1.1.2.custom-deployments -o json
```
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 names... |
Create a job named "report-generation-job" using the PHP image and execute the command "php --version" inside the job. | Command:
```bash
kubectl create job report-generation-job --image=php -- php --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": "Output... |
Set the cluster field in the 'testing-context' context to 'data-cluster' | Command:
```bash
kubectl config set contexts.testing-context.cluster data-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 ... |
Start a PHP pod named "nginx" using the PHP image, but overload the specifications with a partial set of values parsed from a JSON file. | Command:
```bash
kubectl run nginx --image=php --overrides='{ "apiVersion": "v1.1.0", "spec": { ... } }'
```
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] ... |
Import specific keys from a config map into an environment variable for a deployment | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/ui-config deployment/notification-handler-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 definit... |
Update the pod specified in the "config.json" file by adding the annotation "alert-email" with the value "alerts@example.com" | Command:
```bash
kubectl annotate -f config.json alert-email=alerts@example.com
```
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 inclu... |
Forward traffic from port 5000 on all addresses to port 3000 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 5000: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 w... |
Apply a taint with the key 'hardware' on nodes labeled with instance=app-instance-1, specifically on the node with the label app-node-6, and set the taint effect to PreferNoSchedule. | Command:
```bash
kubectl taint node -l instance=app-instance-1 hardware=app-node-6: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": "", "... |
Import the 'log_level' key from the 'ui-config' ConfigMap into the 'email-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/ui-config deployment/email-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 definitions i... |
Start a php pod and expose container port 8443 | Command:
```bash
kubectl run hazelcast --image=php --port=8443
```
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": "--file... |
Create a cron job that runs a command at a specified schedule | Command:
```bash
kubectl create cronjob data-processing --image=jenkins --schedule="*/1 * * * *" -- java -jar /usr/share/jenkins/jenkins.war
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
... |
Create a cluster role named "foo" with the ability to use configmaps and specific resource names (mail-server and app-analytics) | Command:
```bash
kubectl create clusterrole foo --verb=use --resource=configmaps --resource-name=mail-server --resource-name=app-analytics
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|non... |
Import environment variables from a config map with a specific prefix for a deployment. | Command:
```bash
kubectl set env --from=configmap/monitoring-config --prefix=MYSQL_ deployment/search-engine-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... |
Create an ingress called 'public-ingress' with a rule that directs requests from foo.com/input to svc1:8084 and uses the TLS secret "my-cert" | Command:
```bash
kubectl create ingress public-ingress --rule="foo.com/input=svc1:8084,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":... |
Create a job called "testing" with the image "golang" and the command "go" | Command:
```bash
kubectl create job testing --image=golang -- go
```
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: json|... |
Set up an autoscaling policy for the "auth" deployment with a minimum of 6 pods and a maximum of 14 pods | Command:
```bash
kubectl autoscale deployment auth --min=6 --max=14
```
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 uses th... |
Set the custom TLS server name to use for validation for the staging-cluster cluster entry. | Command:
```bash
kubectl config set-cluster staging-cluster --tls-server-name=dev-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... |
Update the 'release-notes' annotation of the 'monitoring' pod with the value 'https://example.com/release-notes/v2.5.1', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods monitoring 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 t... |
Scale the replication controller "chat-app" to automatically adjust the number of pods based on CPU utilization, with a minimum of 1 pod, a maximum of 7 pods, and a target CPU utilization of 40%. | Command:
```bash
kubectl autoscale rc chat-app --max=7 --cpu-percent=40
```
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... |
Start a mysql pod with overridden specifications from JSON | Command:
```bash
kubectl run nginx --image=mysql --overrides='{ "apiVersion": "v1.1.0", "spec": { ... } }'
```
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... |
Create an ingress named 'external-ingress' that directs requests from website.com/input to svc1:7000 with a TLS secret called "my-cert". | Command:
```bash
kubectl create ingress external-ingress --rule="website.com/input=svc1:7000,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": "", "u... |
Add a taint with key 'workload' on nodes having label project=project-alpha | Command:
```bash
kubectl taint node -l project=project-alpha workload=k8s-node-1: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": "", "us... |
Import the `database_url` key from the `app-config` ConfigMap and set it as an environment variable in the `order-processing-deployment` deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-config deployment/order-processing-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... |
Retrieve the logs from the previously terminated 'quantum-quark' container in the 'proxy-server-pod' pod. | Command:
```bash
kubectl logs -p -c quantum-quark proxy-server-pod
```
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"... |
Get the output from running the 'postgres' command in the 'nebula-navigator' container of the 'database-pod' pod. | Command:
```bash
kubectl exec database-pod -c nebula-navigator -- postgres
```
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,... |
Forward the local port 3000 to the port 3000 in the backend-pod pod. | Command:
```bash
kubectl port-forward pod/backend-pod 3000: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... |
Create an ingress named 'app1-ingress' that routes requests from testing.com/input to svc1:9092 using the TLS secret "my-cert". | Command:
```bash
kubectl create ingress app1-ingress --rule="testing.com/input=svc1:9092,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... |
Forward the traffic from port 8000 on localhost and IP address 10.19.21.23 to port 8888 in the 'proxy-server-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 8000:8888
```
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 cr... |
View logs from pod "log-aggregator-pod" written in the last hour | Command:
```bash
kubectl logs --since=1h log-aggregator-pod
```
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", "shor... |
Create a deployment named "proxy" that runs the "php" image and exposes port 8083 | Command:
```bash
kubectl create deployment proxy --image=php --port=8083
```
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|... |
Attach to the running frontend-pod and retrieve its output. | Command:
```bash
kubectl attach frontend-pod
```
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 omitted, use the kubectl.ku... |
Create an ingress resource called 'api-gateway-ingress' with a rule that directs requests for testing.com/module to svc1 on port 8082, using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="testing.com/module=svc1:8082,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": ""... |
forward the local ports 9090 and 6000 to the ports 9090 and 6000 of a pod selected by the log-aggregator-deployment deployment. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 9090 9090
```
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 wi... |
Update the pod with the name 'foo' by adding a label 'component' with the value 'web' | Command:
```bash
kubectl label pods foo component=web
```
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 ... |
View the last-applied-configuration annotations for the preferences.yaml file in JSON format. | Command:
```bash
kubectl apply view-last-applied -f preferences.yaml -o json
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-la... |
Update the security scan status of the pod specified in "config.json" to "pass" | Command:
```bash
kubectl annotate -f config.json security-scan-status=pass
```
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 ar... |
Create a debug copy of `payment-gateway-pod` changing all container images to `node` | Command:
```bash
kubectl debug payment-gateway-pod --copy-to=debug-image-web --set-image=*=node
```
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 n... |
Add a taint with key 'disktype' on nodes that have the label 'stack=tech-stack' | Command:
```bash
kubectl taint node -l stack=tech-stack disktype=storage-node-13: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": "", "us... |
Forward local port 5000 to port 5432 in the pod cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 5000: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 will be selected au... |
Retrieve the snapshot logs from the container named 'proxy-service-pod-1' of the deployment 'analytics-platform-deployment'. | Command:
```bash
kubectl logs deployment/analytics-platform-deployment -c proxy-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 f... |
Get the output of the `dotnet --list-sdks` command from the `monitoring-pod` pod using the `code-explorer` container. | Command:
```bash
kubectl exec monitoring-pod -c code-explorer -- dotnet --list-sdks
```
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... |
Forward traffic from local port 5000 to port 6379 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 5000 6379
```
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... |
Forward traffic from port 5000 on all addresses to port 8088 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 5000: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 wi... |
Forward traffic from all addresses on port 8000 to port 6379 in the cdn-service-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 8000:6379
```
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... |
Create an ingress resource called 'public-service-ingress' that directs requests for testing.com/example to the 'svc1' service on port 8084, and use the tls secret "my-cert" for HTTPS. | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/example=svc1:8084,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"... |
List the deployments in the "sandbox-apps" API group with the version "feature-branch-2.3.0" in JSON output format. | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.sandbox-apps -o json
```
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 nam... |
Get the output from running the 'geth' command inside the auth-service-pod pod, using the first container by default. | Command:
```bash
kubectl exec auth-service-pod -- 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, use the kubectl.kub... |
Use an alternative editor to edit a Kubernetes service | Command:
```bash
KUBE_EDITOR="emacs" kubectl edit svc/gateway-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 variable... |
Start a Ruby pod named "hazelcast" and expose port 9090 | Command:
```bash
kubectl run hazelcast --image=ruby --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": "--fil... |
Import the environment variables from the "ssl-key-secret" secret and set them on the "email-server-deployment" deployment. | Command:
```bash
kubectl set env --from=secret/ssl-key-secret deployment/email-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 definitions in one or more p... |
Forward local ports 8000 and 6000 to ports 8088 and 6000 respectively in the pod called "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 8000 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 select... |
Copy file from a remote pod to a local directory | Command:
```bash
kubectl cp prometheus/cache-pod-5::/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 kubectl.k... |
Execute the 'jenkins --version' command within the code-explorer container of the pod named 'proxy-server-pod'. | Command:
```bash
kubectl exec proxy-server-pod -c code-explorer -- jenkins --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. I... |
Remove the label named 'bar' from the pod 'security' if it exists | Command:
```bash
kubectl label pods security 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": "I... |
Listen on port 9090 locally and forward data to/from port 8080 in the mypod pod | Command:
```bash
kubectl port-forward pod/mypod 9090 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 automaticall... |
Check if you have permission to list the "database-indexing-job" job in the "cert-manager" namespace by running the command "kubectl auth can-i list jobs.batch/database-indexing-job -n cert-manager" | Command:
```bash
kubectl auth can-i list jobs.batch/database-indexing-job -n cert-manager
```
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 par... |
Set the CPU limits of the golang container in the deployment to "1" and the memory limits to "128Mi". | Command:
```bash
kubectl set resources deployment golang -c=nginx --limits=cpu=1,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... |
Import specific keys from a config map to an environment variable for a deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-name-config deployment/proxy-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 variable defin... |
Create a single ingress named 'api-ingress' with a rule that directs requests from foo.com/bar to the service 'svc1' on port 5001 | Command:
```bash
kubectl create ingress api-ingress --rule="foo.com/bar=svc1:5001,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": "Out... |
Forward local port 9090 to pod port 5432, allowing for data transfer | Command:
```bash
kubectl port-forward pod/analytics-pod 9090 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 will be selected auto... |
Copy the `~/.config/kube` directory from the `auth-service-pod-11` pod to the `/tmp/bar_dir` directory locally | Command:
```bash
kubectl cp velero/auth-service-pod-11:~/.config/kube /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 t... |
List deployments in YAML output format in the "beta-1.0" version of the "legacy-apps" API group | Command:
```bash
kubectl get deployments.beta-1.0.legacy-apps -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 w... |
Forward local traffic on port 8000 to port 8088 in the 'monitoring-stack-deployment' pod | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8000 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 ... |
Copy a local file to a remote pod in a specific directory | Command:
```bash
kubectl cp /tmp/foo kubeapps/message-broker-pod-15::/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... |
Get the output from running the 'sleep 3600' command in the analytics-pod pod. | Command:
```bash
kubectl exec analytics-pod -- 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": "Container name. If omitted, use the kubectl.... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/global-config deployment/email-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 defini... |
Forward the local port 8000 to port 6379 in the frontend-pod pod | Command:
```bash
kubectl port-forward pod/frontend-pod 8000:6379
```
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... |
Copy the ~/.config/kube file from the pod named 'file-server-pod-14' in the 'kube-flannel' namespace to the /tmp/bar_dir directory locally. | Command:
```bash
kubectl cp kube-flannel/file-server-pod-14:~/.config/kube /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, ... |
List the replication controller named "web", the service named "analytics-rc", and the pod named "vpn-service-pod" | Command:
```bash
kubectl get rc/web service/analytics-rc pods/vpn-service-pod
```
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 namespac... |
Create a pod named "hazelcast" with the image "nginx" and set the environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container. | Command:
```bash
kubectl run hazelcast --image=nginx --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
```
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] -- [COMM... |
Add a taint with key 'special' on nodes that have the label customer=acme-corp. | Command:
```bash
kubectl taint node -l customer=acme-corp special=monitoring-node-15: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": "",... |
Start a centos pod using the default command, but pass custom arguments for that command | Command:
```bash
kubectl run nginx --image=centos -- <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...]`
Helpful flags:
... |
Create a single ingress called 'app-proxy-ingress' that directs requests to foo.com/module to svc1:5432 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app-proxy-ingress --rule="foo.com/module=svc1:5432,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": "", "usa... |
Remove the taint with key 'workload' and effect 'NoSchedule' from node 'kube-master-9' | Command:
```bash
kubectl taint nodes kube-master-9 workload: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 o... |
Forward traffic from local port 6379 to port 8080 in a pod selected by the web-app-deployment deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 6379 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 s... |
Create an ingress resource called 'private-ingress' that directs requests from testing.com/input to the service 'svc1' on port 6379 | Command:
```bash
kubectl create ingress private-ingress --rule="testing.com/input=svc1:6379,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": "", "us... |
Delete the 'email' pod and 'monitoring' service | Command:
```bash
kubectl delete pod,service email monitoring
```
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 selector... |
Create a debug container in the api-service-pod with the image "debian" | Command:
```bash
kubectl debug api-service-pod -it --copy-to=debug-image-1 --image=debian --set-image=scheduler=my-scheduler:1.0,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by ... |
Create a copy of the auth-service-pod and change all container images to "ethereum/client-go" | Command:
```bash
kubectl debug auth-service-pod --copy-to=my-debugger --set-image=*=ethereum/client-go
```
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 defau... |
Create a role named "reader" with ResourceName specified | Command:
```bash
kubectl create role reader --verb=update --resource=pods --resource-name=file-processing --resource-name=machine-learning
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=ser... |
Create a deployment named 'grafana' using the 'postgres' image and expose port '9090'. | Command:
```bash
kubectl create deployment grafana --image=postgres --port=9090
```
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... |
Create an ingress called 'app2-ingress' that directs requests from foo.com/input to svc # svc1:8083 using a tls secret named "my-cert" | Command:
```bash
kubectl create ingress app2-ingress --rule="foo.com/input=svc1:8083,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": "... |
Create a single ingress called 'api-v1-ingress' that directs requests to foo.com/example to svc1:5001 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress api-v1-ingress --rule="foo.com/example=svc1:5001,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... |
Retrieve the previous terminated logs of the 'astro-container' container from the 'web-app-pod' pod | Command:
```bash
kubectl logs -p -c astro-container web-app-pod
```
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", "... |
Create an ingress called 'myapp-ingress' with the following rule: direct requests from foo.com/example to svc1:6379 | Command:
```bash
kubectl create ingress myapp-ingress --rule="foo.com/example=svc1:6379,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"... |
Create a service for the replicated alpine container using a replica set | Command:
```bash
kubectl expose rs alpine --port=8080 --target-port=808300
```
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.... |
Copy the local file "/tmp/foo_dir" to the remote pod "logging-agent-pod-7" in the "cert-manager" namespace, under the directory "/etc/kubernetes". | Command:
```bash
kubectl cp /tmp/foo_dir cert-manager/logging-agent-pod-7:/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 a taint with key 'datacenter' on nodes that have the label 'myLabel' | Command:
```bash
kubectl taint node -l myLabel datacenter=kube-master-9: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": "Ou... |
Add a new environment variable 'SMTP_USERNAME' to the deployment 'notification-handler-deployment' | Command:
```bash
kubectl set env deployment/notification-handler-deployment SMTP_USERNAME=your-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... |
Return the phase value of the 'monitoring-pod' pod. | Command:
```bash
kubectl get -o template pod/monitoring-pod --template={{.status.phase}}
```
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 ... |
Add a taint with the key 'special' and the value 'backup-node-14:PreferNoSchedule' on the nodes having the label 'namespace=mynamespace' | Command:
```bash
kubectl taint node -l namespace=mynamespace special=backup-node-14: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": "", ... |
Create an ingress resource called 'private-service-ingress' with the following rule: requests to testing.com/module should be directed to the service 'svc1' on port 3306 | Command:
```bash
kubectl create ingress private-service-ingress --rule="testing.com/module=svc1:3306,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"... |
Create an ingress resource named 'www-ingress' with a rule that directs requests from website.com/input to svc1:9000 | Command:
```bash
kubectl create ingress www-ingress --rule="website.com/input=svc1:9000,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"... |
Update pod 'analytics' with the annotation 'criticality' and the value 'high', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods analytics criticality='high'
```
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 inclu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.