prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Copy the /tmp/foo_dir directory from the monitoring-agent-pod-6 pod in the kube-flannel namespace to the /tmp/bar directory on your local machine. | Command:
```bash
kubectl cp kube-flannel/monitoring-agent-pod-6:/tmp/foo_dir /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, us... |
Add a taint with the key 'workload' on all nodes that have the label 'instance=app-instance-1' | Command:
```bash
kubectl taint node -l instance=app-instance-1 workload=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": "... |
Add a taint with key 'dedicated' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 dedicated=db-node-7: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": "... |
Apply a taint with the key 'zone' on nodes that have the label tier=frontend | Command:
```bash
kubectl taint node -l tier=frontend zone=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": "", "usage"... |
Create a copy of the chat-app-pod pod, adding a debug container, and changing container images | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=debug-image-memcached --image=debian --set-image=worker=my-custom-worker:1.2.3,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects iden... |
Forward port 8000 on all addresses to port 8000 in the pod with the name "proxy-server-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/proxy-server-pod 8000: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 ... |
Create a service for a replication controller using the configuration defined in "ruby-controller.yaml" file | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=3000 --target-port=900000
```
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 s... |
Import specific keys from a config map into the environment of a deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-config-prod 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 defi... |
Create a cluster role binding 'bar' with the 'bar' cluster role for the users 'jane.doe' and 'bob.smith' and the group 'developers' | Command:
```bash
kubectl create clusterrolebinding bar --clusterrole=bar --user=jane.doe --user=bob.smith --group=developers
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--servic... |
List deployments in JSON output format, using the "v1.1.0" version of the "experimental-apps" API group. | Command:
```bash
kubectl get deployments.v1.1.0.experimental-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 namespaced y... |
Execute a command 'postgres' inside the first pod of the deployment 'monitoring-stack-deployment' | Command:
```bash
kubectl exec deploy/monitoring-stack-deployment -- 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 omitte... |
Output the modified 'log-aggregator-deployment' deployment in YAML format, without making any changes to the object on the server | Command:
```bash
kubectl set env deployment/log-aggregator-deployment JWT_SECRET=your-jwt-secret -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 o... |
Forward traffic from local port 6379 to port 5432 in the web-app-pod | Command:
```bash
kubectl port-forward pod/web-app-pod 6379: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 automa... |
Set the cluster field in the my-context context to data-cluster. | Command:
```bash
kubectl config set contexts.cluster-2-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 yo... |
Create a deployment named scheduler that uses the centos image and has 5 replicas. | Command:
```bash
kubectl create deployment scheduler --image=centos --replicas=5
```
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 o... |
Create a debug container within the chat-app-pod, copying its configuration, and changing the image of the debug container as well as the images of the existing containers. | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=debug-image-1 --image=debian --set-image=database=mysql:5.7,cache=redis:alpine
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource an... |
Create a role named "view" with API Group specified | Command:
```bash
kubectl create role view --verb=proxy,get,update --resource=networkpolicies.networking.k8s.io
```
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=server|client|none]`
Helpful f... |
Auto scale a deployment called "foo" with a minimum of 1 pod and a maximum of 11 pods. | Command:
```bash
kubectl autoscale deployment foo --min=1 --max=11
```
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 the... |
Import the 'DEBUG_MODE' key from the 'ui-config' ConfigMap and set it as an environment variable in the 'payment-processor-deployment' deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/ui-config deployment/payment-processor-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... |
Attach to the 'nebula-navigator' container inside the 'database-pod' pod, switch to raw terminal mode, and send stdin to 'bash' while sending stdout/stderr back to the client. | Command:
```bash
kubectl attach database-pod -c nebula-navigator -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 o... |
Change the service account for the deployment "load-balancer-deployment" to "argocd". | Command:
```bash
kubectl set serviceaccount deployment load-balancer-deployment argocd
```
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:
`kubec... |
Partially update a node's configuration using a strategic merge patch in JSON format | Command:
```bash
kubectl patch node edge-node-10 -p '{"spec":{"type":"LoadBalancer"}'
```
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 patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Help... |
Attach to the code-explorer container in the chat-app-pod and interact with the terminal in real-time. | Command:
```bash
kubectl attach chat-app-pod -c code-explorer -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 omit... |
Create a service for a replicated php using a replica set, which serves on port 8888 and connects to the containers on port 8000 | Command:
```bash
kubectl expose rs php --port=8888 --target-port=800000
```
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. A ... |
Start a confluentinc/cp-kafka pod with specific configurations | Command:
```bash
kubectl run nginx --image=confluentinc/cp-kafka --overrides='{ "apiVersion": "v2.0.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] [--comm... |
Verify if you have permission to list the "backup-job" in the "monitoring" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/backup-job -n monitoring
```
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... |
Edit the service "web-service" using the "vi" editor. | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/web-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, or f... |
Retrieve the output of the "gem --version" command from the container named "mycontainer" running inside the pod named "database-pod" | Command:
```bash
kubectl exec database-pod -c mycontainer -- gem --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 omitted,... |
Create a debug pod named 'debug-image-web' based on the 'log-aggregator-pod' pod, but change all container images to busybox. | Command:
```bash
kubectl debug log-aggregator-pod --copy-to=debug-image-web --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... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/app-config-dev deployment/monitoring-stack-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... |
Create a cluster role binding with the name "view" and bind the "view" cluster role to the users "developer3", "k8s-admin", and the group "qa-engineers". | Command:
```bash
kubectl create clusterrolebinding view --clusterrole=view --user=developer3 --user=k8s-admin --group=qa-engineers
```
What it does:
Create a cluster role binding for a particular cluster role.
Syntax:
`kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--... |
Scale the backend-service-replicaset deployment to 1 replica if the current size is 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=1 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 service for a replication controller based on the configuration in "ruby-controller.yaml" file, which listens on port 3306 and connects to the containers on port 8080. | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=3306 --target-port=808000
```
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 s... |
Embed the certificate authority data for the "edge-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster edge-cluster --embed-certs --certificate-authority=~/.kube/star-cluster/kubernetes.ca.crt
```
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... |
Listen on port 8088 locally, forwarding data to/from port 3000 in a pod selected by the api-server-deployment deployment | Command:
```bash
kubectl port-forward deployment/api-server-deployment 8088 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 b... |
Execute the 'go' command in the gateway-pod pod. | Command:
```bash
kubectl exec gateway-pod -- go
```
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.kubernetes... |
Set the custom TLS server name to 'moon-cluster' for the 'edge-cluster' cluster entry | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=moon-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] [--certificate... |
Auto scale the deployment "cdn" with the number of pods ranging between 2 and 11. | Command:
```bash
kubectl autoscale deployment cdn --min=2 --max=11
```
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 the... |
Create a single ingress called 'app2-ingress' that directs requests to site.com/example to svc # svc1:8084 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress app2-ingress --rule="site.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": "", "usage"... |
Update the service account for the 'database-deployment' deployment to 'prometheus' | Command:
```bash
kubectl set serviceaccount deployment database-deployment prometheus
```
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:
`kubect... |
Approve a certificate signing request (CSR) for 'csr-frontend-4'. | Command:
```bash
kubectl certificate approve csr-frontend-4
```
What it does:
Approve a certificate signing request.
kubectl certificate approve allows a cluster admin to approve a certificate signing request (CSR). This action tells a certificate signing controller to issue a certificate to the requestor with the att... |
import the 'API_KEY' key from the 'api-config' config map and set it as an environment variable for the 'database-deployment' deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/api-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 definitions in one... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/env-vars deployment/mydeployment
```
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 ... |
Import the "debug_mode" key from the "monitoring-config" config map into the "order-processing-deployment" deployment. | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/monitoring-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 ... |
Create a new ExternalName service named external-third-party-api-service and set its external name as example-domain.com. | Command:
```bash
kubectl create service externalname external-third-party-api-service --external-name example-domain.com
```
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 ref... |
Begin streaming the logs of the "nano-bot" container in the "database-pod" pod | Command:
```bash
kubectl logs -f -c nano-bot database-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", "short"... |
Set the annotation 'criticality' to 'high' for the 'proxy' pod. | Command:
```bash
kubectl annotate pods proxy 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 include arbitrary strin... |
Create a new config map named 'app-config' using the environment variables defined in the 'parameters.env' file. | Command:
```bash
kubectl create configmap app-config --from-env-file=path/to/parameters.env
```
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 ... |
Forward port 8000 in the pod "backend-pod" to port 8888 on all addresses | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8888: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 ... |
Update the image of all containers in the daemonset named "staging" to "php:7.4.22" | Command:
```bash
kubectl set image daemonset staging *=php:7.4.22
```
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:
`kubec... |
List all the environment variables defined on the 'cache-cluster-deployment' deployment. | Command:
```bash
kubectl set env deployment/cache-cluster-deployment --list
```
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 templates (within ... |
Port forward from local ports 6379 to pod port 3000, for the deployment/analytics-platform-deployment pod | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 6379 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 po... |
Configure the e2e cluster to use a custom TLS server name for validation. | Command:
```bash
kubectl config set-cluster e2e --tls-server-name=prod-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] [--certificate-authorit... |
Create a service for the Hazelcast deployment with port 80, connecting to the containers on port 8000. | Command:
```bash
kubectl expose deployment hazelcast --port=6379 --target-port=500000
```
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 or update exec auth plugin environment variables for the "admin" entry | Command:
```bash
kubectl config set-credentials admin --exec-env=key1=val1 --exec-env=key2=val2
```
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 ... |
Switch to raw terminal mode and send stdin to 'bash' in the 'cyber-sleuth' container from the 'api-service-pod' pod | Command:
```bash
kubectl exec api-service-pod -c cyber-sleuth -i -t -- bash -il
```
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 omi... |
add the "compliance-level" annotation with the value "PCI-DSS" to the pod specified in the "pod.json" file | Command:
```bash
kubectl annotate -f pod.json compliance-level=PCI-DSS
```
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 arbitr... |
Create a new config map named app-config-prod with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-prod --from-file=properties=/path/to/profiles/file1.txt --from-file=key1=/path/to/configurations/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... |
Add a taint with key 'app' and value 'kube-master-9:PreferNoSchedule' to all nodes with the label 'team=devops' | Command:
```bash
kubectl taint node -l team=devops app=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": "Outpu... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/kube-system-config deployment/frontend-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... |
Return the snapshot logs from the container "api-server-deployment-1" of the deployment named "security-service-pod". | Command:
```bash
kubectl logs deployment/api-server-deployment -c security-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 flags:... |
Create a new service named "php-https" based on the existing "php" service, exposing the container port 8443 as port 443 | Command:
```bash
kubectl expose service php --port=443 --target-port=5432 --name=nginx-https
```
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 t... |
Forward traffic from port 8088 on localhost and IP 10.19.21.23 to port 8080 in the pod named chat-app-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 8088: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 criter... |
Listen on the localhost and IP 10.19.21.23, and forward the traffic from port 5000 to port 8000 in the 'api-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 5000: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 cri... |
Import the 'log_level' 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=log_level --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 definitio... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/db-config 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 definitions ... |
Set the CPU and memory limits to 200 milliCPU and 512 MiB respectively, and set the CPU and memory requests to 5 CPU units and 1 GiB for all containers in the wordpress deployment. | Command:
```bash
kubectl set resources deployment wordpress --limits=cpu=200m,memory=512Mi --requests=cpu=5,memory=1Gi
```
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 request... |
Create a new secret named 'payment-gateway-secret' using the environment variables from the 'profiles.env' file. | Command:
```bash
kubectl create secret generic payment-gateway-secret --from-env-file=path/to/profiles.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 to t... |
Patch a node's configuration with new values | Command:
```bash
kubectl patch -f node-config.toml -p '{"spec":{"someField":"newValue"}'
```
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 patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
H... |
Set up autoscaling for the "payment" deployment, with the number of pods ranging from 7 to 12 | Command:
```bash
kubectl autoscale deployment payment --min=7 --max=12
```
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... |
Create a service for the specified replication controller, serving on port 5000 and connecting to the containers on port 818100. | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=5000 --target-port=818100
```
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 ... |
Import environment variables from a secret for a specific deployment. | Command:
```bash
kubectl set env --from=secret/tls-certificate-secret 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 variable definition... |
Update the 'authentication-service-deployment' deployment by adding a new environment variable 'CACHE_SIZE' with a value of '64MB' | Command:
```bash
kubectl set env deployment/authentication-service-deployment CACHE_SIZE=64MB
```
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 ... |
Remove the taint with key 'dedicated' and effect 'NoSchedule' from node 'k8s-node-1' if it exists | Command:
```bash
kubectl taint nodes k8s-node-1 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:... |
Apply a taint on nodes with a specific label. | Command:
```bash
kubectl taint node -l tier=frontend disktype=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": "", "usage": "... |
Execute the 'yum install -y wget' command in the astro-container of the mypod pod and retrieve the output. | Command:
```bash
kubectl exec mypod -c astro-container -- yum install -y wget
```
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 omitt... |
Set the resource request and limits for all containers in the "ubuntu" deployment | Command:
```bash
kubectl set resources deployment ubuntu --limits=cpu=200m,memory=512Mi --requests=cpu=50m,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 reques... |
Forward traffic from port 8080 on all addresses to port 8081 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8080:8081
```
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 a deployment named app with the ubuntu image and expose port 7000 | Command:
```bash
kubectl create deployment app --image=ubuntu --port=7000
```
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... |
Set the custom TLS server name to use for validation for the "dev-cluster" cluster entry in the kubeconfig file | Command:
```bash
kubectl config set-cluster dev-cluster --tls-server-name=kube-cluster-1
```
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] [--certificat... |
Define new exec auth plugin args for the "k8s-admin" entry by setting the credentials using the command: | Command:
```bash
kubectl config set-credentials k8s-admin --exec-arg=arg1 --exec-arg=arg2
```
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 ... |
Create a copy of the 'cdn-service-pod' by running the kubectl debug command with the parameters --copy-to=debug-image-memcached --set-image=*=golang, ensuring that all container images are changed to 'golang'. | Command:
```bash
kubectl debug cdn-service-pod --copy-to=debug-image-memcached --set-image=*=golang
```
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 ... |
Copy the directory "/tmp/foo_dir" from the remote pod "kube-flannel/worker-pod-4" to the local directory "/etc/kubernetes" | Command:
```bash
kubectl cp kube-flannel/worker-pod-4:/tmp/foo_dir /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, use t... |
Create an ingress called 'public-api-ingress' with a rule that directs requests from website.com/example to svc1:8082 | Command:
```bash
kubectl create ingress public-api-ingress --rule="website.com/example=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": ""... |
Update the pod specified in the "pod.json" file by adding the annotation "alert-email" with the value "alerts@example.com" | Command:
```bash
kubectl annotate -f pod.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 include ... |
Execute the command 'yum install -y wget' in the 'nano-bot' container of the 'media-stream-pod' pod and display the output. | Command:
```bash
kubectl exec media-stream-pod -c nano-bot -- yum install -y wget
```
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 o... |
Forward local port 3000 to port 8000 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 3000: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 a... |
Forward port 5432 on all addresses to port 8088 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 5432: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 ... |
Listen on port 6379 and forward traffic to port 3000 in the frontend-pod pod, allowing connections from all addresses (0.0.0.0). | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/frontend-pod 6379: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... |
Import the 'max_connections' key from the 'ui-config' config map into the 'user-management-deployment' deployment. | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/ui-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 defi... |
Create a copy of the email-service-pod, changing all container images to ethereum/client-go for debugging purposes. | Command:
```bash
kubectl debug email-service-pod --copy-to=debug-image-app --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 ... |
Replace a pod using the data defined in a YAML file | Command:
```bash
kubectl replace -f ./preferences.yaml
```
What it does:
Replace a resource by file name or stdin.
JSON and YAML formats are accepted. If replacing an existing resource, the complete resource spec must be provided. This can be obtained by
$ kubectl get TYPE NAME -o yaml
Syntax:
`kubectl replace -f FIL... |
Update the criticality level of a pod identified in the "options.json" file. | Command:
```bash
kubectl annotate -f options.json 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 include arbitrary ... |
Update the label of the 'monitoring' pod by adding the label 'component' with the value 'worker'. | Command:
```bash
kubectl label pods monitoring component=worker
```
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", "us... |
Create a Pod Disruption Budget named "api-service-pdb" that selects all pods with the label "version=v2" and ensures that at least one of these pods is available at all times. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=version=v2 --min-available=1
```
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-available=N [--... |
Create a copy of the frontend-pod with the container images changed to node. Name the new pod debug-image-memcached. | Command:
```bash
kubectl debug frontend-pod --copy-to=debug-image-memcached --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 no... |
Create a new config map named monitoring-config with keys "settings" and "key2" using the specified files "/path/to/data/file1.txt" and "/path/to/properties/file2.txt" respectively. | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/path/to/properties/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 creatin... |
Create a new config map named app-name-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-name-config --from-file=properties=/path/to/options/file1.txt --from-file=key1=/path/to/configs/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 creatin... |
Partially update the node specified in "node.json" using the strategic merge patch technique | Command:
```bash
kubectl patch -f node-specific.yaml -p '{"spec":{"someField":"newValue"}'
```
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 patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
... |
Forward port 8081 on your local machine to port 8000 in the e-commerce-pod pod. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8081: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 aut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.