prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Partially update the "node-2" node by specifying a strategic merge patch in JSON format | Command:
```bash
kubectl patch node node-2 -p '{"spec":{"containers":[{"name":"container-name", "resources":{"limits":{"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 patch (-f FILEN... |
Get the output from running the 'wp' command in the 'stardust-shuttle' container from the pod named 'log-aggregator-pod' | Command:
```bash
kubectl exec log-aggregator-pod -c stardust-shuttle -- 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,... |
Forward local traffic on port 5000 to the pod selected by the deployment named "monitoring-stack-deployment" on port 9090 | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 5000 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 ... |
List deployments from the "testing-apps" API group in JSON format, using the "v3.0.0" version of the API. | Command:
```bash
kubectl get deployments.v3.0.0.testing-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 you wi... |
Create a job named 'indexing' with the image 'alpine' and run the command 'apk add curl' | Command:
```bash
kubectl create job indexing --image=alpine -- apk add curl
```
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. On... |
Import the MAX_CONNECTIONS key from the monitoring-config config map into the environment variables of the backend-microservice-deployment deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/monitoring-config deployment/backend-microservice-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 ... |
Create a new secret named jwt-secret with keys for each file in folder bar. | Command:
```bash
kubectl create secret generic jwt-secret --from-file=path/to/options
```
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 of the fi... |
Edit the last-applied-configuration annotations of a resource using a JSON file. | Command:
```bash
kubectl apply edit-last-applied -f conf.yaml -o json
```
What it does:
Edit the latest last-applied-configuration annotations of resources from the default editor.
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the e... |
Create a pod disruption budget named ingress-controller-pdb that will select all pods with the tier=frontend label and require a minimum of 9 of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=tier=frontend --min-available=9
```
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 the version of MySQL running in the Warp Drive container of the CDN service pod by executing the 'mysql --version' command. | Command:
```bash
kubectl exec cdn-service-pod -c warp-drive -- mysql --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 omit... |
Create an ingress named ingtls with TLS enabled using the default ingress certificate | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="testing.com/=svc:https,tls" \
--rule="testing.com/path/subpath*=othersvc:7000"
```
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"... |
Update the label of a pod with a specific value | Command:
```bash
kubectl label pods proxy-server role=cache
```
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"... |
Retrieve the output from running the 'dotnet' command within the chat-app-pod pod's first container. | Command:
```bash
kubectl exec chat-app-pod -- 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 the kubectl.kuber... |
Set the cluster field in the 'my-context' context to 'prod-cluster' | Command:
```bash
kubectl config set contexts.client-2-context.cluster prod-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... |
Create an autoscaling policy for the 'log-aggregator' deployment with a minimum of 6 pods and a maximum of 11 pods | Command:
```bash
kubectl autoscale deployment log-aggregator --min=6 --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 th... |
Create a service for a replicated CentOS, which serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose rc centos --port=8000 --target-port=801000
```
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.... |
Start streaming the logs of the lunar-launcher container in the backend-pod pod. | Command:
```bash
kubectl logs -f -c lunar-launcher backend-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", "s... |
Import specific keys from a config map to set environment variables for a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/db-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... |
Forward local port 5000 to the pod's port 5000 and listen on all addresses | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 5000: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 ... |
Run the 'python' command in the cyber-sleuth container of the media-stream-pod pod and get the output. | Command:
```bash
kubectl exec media-stream-pod -c cyber-sleuth -- python
```
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... |
Create a cluster role named "admin_role" with the ability to delete services and specific resource names such as 'load-balancer' and 'dev-database'. | Command:
```bash
kubectl create clusterrole admin_role --verb=delete --resource=services --resource-name=load-balancer --resource-name=dev-database
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|c... |
Begin streaming the logs of the specific container in a pod | Command:
```bash
kubectl logs -f -c time-machine e-commerce-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", "... |
Delete the pods and services with the names "foo" and "auth". | Command:
```bash
kubectl delete pod,service foo auth
```
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.
Some r... |
Disable certificate checking for the 'cluster-gamma' entry in the kubeconfig configuration. | Command:
```bash
kubectl config set-cluster cluster-gamma --insecure-skip-tls-verify=true
```
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... |
Import specific keys from a config map into an environment variable for a deployment | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-name-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 vari... |
Get the output of the 'jenkins --version' command from the first pod of the deployment 'analytics-platform-deployment' in the default container. | Command:
```bash
kubectl exec deploy/analytics-platform-deployment -- 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... |
Create a new ClusterIP service named billing-service-clusterip, which listens on port 9090 and forwards traffic to port 9090. | Command:
```bash
kubectl create service clusterip billing-service-clusterip --tcp=9090:9090
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o"... |
Create a new secret named ssl-key-secret with keys for each file in the specified folder. | Command:
```bash
kubectl create secret generic ssl-key-secret --from-file=path/to/configurations
```
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 basenam... |
Add or update the annotation 'contact-email' for the pod 'foo' with the value 'support@example.com' | Command:
```bash
kubectl annotate pods foo contact-email=support@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 ... |
Create a new config map named app-settings with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-settings --from-file=conf=/path/to/configs/file1.txt --from-file=data=/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 creating a confi... |
Open a raw terminal connection to the cyber-sleuth container in the chat-app-pod pod | Command:
```bash
kubectl attach chat-app-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... |
Create a service for the replication controller specified in "wordpress-controller.yaml", with the following parameters: serve on port 80, connect to containers on port 8000. | Command:
```bash
kubectl expose -f wordpress-controller.yaml --port=8000 --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 ... |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/kube-system-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 v... |
Forward traffic from port 8088 on localhost and IP 10.19.21.23 to port 5000 in the pod "api-service-pod". | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 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 cri... |
Forward local port 5000 to the remote port 8888 in the specified deployment | Command:
```bash
kubectl port-forward deployment/database-deployment 5000 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 criteria, a pod will be ... |
Add a taint with the key 'disktype' on nodes having the label project=project-alpha | Command:
```bash
kubectl taint node -l project=project-alpha disktype=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... |
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=settings=/path/to/options/file1.txt --from-file=key2=/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 creating ... |
Run the mysqld command in the cyber-sleuth container of the database-pod and get the output | Command:
```bash
kubectl exec database-pod -c cyber-sleuth -- mysqld
```
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 t... |
import the 'REDIS_HOST' key from the 'global-config' config map and set it as an environment variable in the 'analytics-platform-deployment' deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/global-config deployment/analytics-platform-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 de... |
Forward local port 8080 to pod port 5000 | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8080: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 aut... |
Create a job named 'audit-job' with the nginx image and the command 'nginx -g "daemon off;"' | Command:
```bash
kubectl create job audit-job --image=nginx -- nginx -g "daemon off;"
```
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 ... |
Copy the file /tmp/foo from the payment-gateway-pod-19 pod in the metallb-system namespace to the /etc/kubernetes directory locally. | Command:
```bash
kubectl cp metallb-system/payment-gateway-pod-19:/tmp/foo /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 omitte... |
Create a role named "view" with specific resource names | Command:
```bash
kubectl create role view --verb=use --resource=pods --resource-name=app-analytics --resource-name=app-worker-1
```
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|... |
Delete pods and services with names "chat-app" and "media-stream" | Command:
```bash
kubectl delete pod,service chat-app media-stream
```
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 sel... |
Expose the replica set "ubuntu" as a service on port 8081, connecting to the containers on port 808000. | Command:
```bash
kubectl expose rs ubuntu --port=8081 --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 specified port.... |
Create a deployment named "jenkins" with 5 replicas, using the Redis image. | Command:
```bash
kubectl create deployment jenkins --image=redis --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 of: ... |
Create a cron job that runs a bash command every minute | Command:
```bash
kubectl create cronjob backup-job --image=amazonlinux --schedule="*/1 * * * *" -- /bin/bash -c "echo 'Hello
```
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:
"flag": "--outpu... |
Import the 'redis_host' key from the 'app-config-dev' config map and set it as an environment variable in the 'payment-processor-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-config-dev 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 de... |
Run the 'apk add curl' command in the 'cyber-sleuth' container of the 'payment-gateway-pod' pod and get the output. | Command:
```bash
kubectl exec payment-gateway-pod -c cyber-sleuth -- apk add curl
```
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... |
Create a copy of the security-service-pod and launch an interactive shell in the quantum-quark container of the copied pod named my-custom-dbg. | Command:
```bash
kubectl debug security-service-pod -it --copy-to=my-custom-dbg --container=quantum-quark -- sh
```
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... |
update the label of the 'web' pod to set the 'tier' label to 'backend' | Command:
```bash
kubectl label pods web tier=backend
```
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... |
create a new config map named app-config-dev using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-dev --from-file=conf=/path/to/settings/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 creating a confi... |
Set the resource requests and limits for all containers in the 'runtime' deployment | Command:
```bash
kubectl set resources deployment runtime --limits=cpu=200m,memory=512Mi --requests=cpu=200m,memory=2Gi
```
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... |
Embed the certificate authority data for the edge-cluster cluster entry by running the command "kubectl config set-cluster edge-cluster --embed-certs --certificate-authority=~/.kube/web-cluster/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster edge-cluster --embed-certs --certificate-authority=~/.kube/web-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-... |
Start a proxy to the Kubernetes API server, with the API prefix set to /k8s-api. | Command:
```bash
kubectl proxy --api-prefix=/k8s-api
```
What it does:
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote Kubernet... |
Create a single ingress called 'service-ingress' with a rule that directs requests from site.com/example to svc1 on port 5432, using a TLS secret named "my-cert". | Command:
```bash
kubectl create ingress service-ingress --rule="site.com/example=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... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/app-settings 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 ... |
Forward the local port 5432 to port 8888 in the 'security-service-pod' pod | Command:
```bash
kubectl port-forward pod/security-service-pod 5432: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 criteria, a pod will be select... |
Set the client-key-data field for the john.doe user using --set-raw-bytes option | Command:
```bash
kubectl config set users.john.doe.client-key-data cert_data_here --set-raw-bytes=true
```
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 ... |
Get the documentation of the `replicas` field in the `spec` section of the `services` resource. | Command:
```bash
kubectl explain resource=services.spec.replicas
```
What it does:
List the fields for supported resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive flag to... |
Retrieve the snapshot logs from the container backend-pod-1 of the mydeployment-1 deployment. | Command:
```bash
kubectl logs deployment/mydeployment -c backend-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:
"flag": "--contai... |
Retrieve the list of Kafka topics by running the 'kafka-topics --list' command in the rocket-ranger container of the payment-gateway pod. | Command:
```bash
kubectl exec payment-gateway-pod -c rocket-ranger -- kafka-topics --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... |
Forward traffic from port 8081 on localhost and IP 10.19.21.23 to port 3000 in the pod 'log-aggregator-pod' using the command 'kubectl port-forward'. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8081: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 ... |
Set the cluster field in a specific context to a given cluster name | Command:
```bash
kubectl config set contexts.user-a-context.cluster sun-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... |
Apply a strategic merge patch to update a specific node with the specified JSON patch | Command:
```bash
kubectl patch node gpu-node-12 -p '{"data":{"key":"new-value"}'
```
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]`
Helpful f... |
Import the DATABASE_URL key from the api-config config map into the notification-handler-deployment deployment. | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/api-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 d... |
Create a pod disruption budget named api-service-pdb that will select all pods with the component=web label and require at least four of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget api-service-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-available=N ... |
Get the output from running the 'bash' command in the rocket-ranger container of the vpn-service-pod pod. | Command:
```bash
kubectl exec vpn-service-pod -c rocket-ranger -- 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, use... |
Create a single ingress called 'app-loadbalancer-ingress' that directs requests to foo.com/input to the service 'svc1' on port 9092, using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="foo.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": ""... |
Create a job that runs a specific command with the given image | Command:
```bash
kubectl create job database-seeding-job --image=jenkins -- jenkins --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": ... |
Add a taint with key 'environment' on nodes having label myLabel and value testing-node-11 with the effect of PreferNoSchedule. | Command:
```bash
kubectl taint node -l myLabel environment=testing-node-11: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": ... |
Partially update the k8s-node-1 node by setting the "unschedulable" flag to true using a strategic merge patch in the form of a JSON object. | Command:
```bash
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
```
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]`
Helpfu... |
Create a deployment named jenkins-x that runs the mongo image | Command:
```bash
kubectl create deployment jenkins-x --image=mongo
```
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|yaml|n... |
Create a new config map named 'global-config' with the specified keys, 'settings' and 'key2', using the files '/path/to/parameters/file1.txt' and '/path/to/configs/file2.txt' respectively. | Command:
```bash
kubectl create configmap global-config --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/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 creating... |
create an ingress called 'website-ingress' that directs requests to testing.com/module to svc # svc1:7000 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="testing.com/module=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... |
Create a pod named "hazelcast" using the provided image and expose port 6379 | Command:
```bash
kubectl run hazelcast --image=docker.elastic.co/elasticsearch/elasticsearch --port=6379
```
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] ... |
Forward local port 9090 to port 8081 in the 'email-server-deployment' deployment | Command:
```bash
kubectl port-forward deployment/email-server-deployment 9090 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 will... |
Create a role named "foo" with the ability to update pods and specific resource names like "auth-proxy" and "cdn-proxy". | Command:
```bash
kubectl create role foo --verb=update --resource=pods --resource-name=auth-proxy --resource-name=cdn-proxy
```
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... |
Create a new pod based on the options.json file passed as input | Command:
```bash
cat options.json | kubectl create -f -
```
What it does:
Create a resource from a file or from stdin.
JSON and YAML formats are accepted.
Syntax:
`kubectl create -f FILENAME`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files to use to... |
Delete pods and services named "media-stream" and "proxy" | Command:
```bash
kubectl delete pod,service media-stream proxy
```
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... |
Copy a file from a remote pod to a local directory. | Command:
```bash
kubectl cp kube-proxy/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... |
Execute the 'irb' command in the container 'lunar-launcher' within the pod 'vpn-service-pod' and retrieve the output. | Command:
```bash
kubectl exec vpn-service-pod -c lunar-launcher -- irb
```
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... |
Create a copy of the 'monitoring-pod' by adding a debug container with the 'debian' image | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-web --image=debian --set-image=api=api:v2,api=api:v2
```
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... |
Update the image of all containers in the 'test' DaemonSet to 'wordpress:5.8.1' | Command:
```bash
kubectl set image daemonset test *=wordpress:5.8.1
```
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:
`kub... |
Create a new ClusterIP service named 'backend-service-clusterip', forwarding traffic from port 3001 to port 5432 | Command:
```bash
kubectl create service clusterip backend-service-clusterip --tcp=3001:5432
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o"... |
Execute the 'elasticsearch' command in the 'cosmic-container' from the pod 'email-service-pod' and get the output. | Command:
```bash
kubectl exec email-service-pod -c cosmic-container -- elasticsearch
```
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... |
Forward local port 8080 to port 6379 in the pod named 'log-aggregator-pod' | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8080: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... |
Listen on port 6379 on localhost and IP 10.19.21.23, forwarding the traffic to port 9090 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 6379: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 th... |
Add a taint with key 'special' on nodes having label environment=production. | Command:
```bash
kubectl taint node -l environment=production special=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": "", "usa... |
Create a deployment named jenkins that runs the mcr.microsoft.com/dotnet/core/runtime image. | Command:
```bash
kubectl create deployment jenkins --image=mcr.microsoft.com/dotnet/core/runtime
```
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": "Outp... |
Forward local port 8080 to port 5432 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 8080: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 aut... |
Open the 'api-service' service for editing using the 'vim' editor | Command:
```bash
KUBE_EDITOR="vim" kubectl edit svc/api-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 ... |
Change the service account of the deployment "scheduler-app-deployment" to "prometheus". | Command:
```bash
kubectl set serviceaccount deployment scheduler-app-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:
`k... |
Update the pod 'frontend' with the annotation 'SLA' and the value '99.9% uptime', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods frontend SLA='99.9% uptime'
```
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 includ... |
Create an ingress named 'web-ingress' that routes requests from foo.com/bar to svc1:5000 and configure TLS encryption using the 'my-cert' secret. | Command:
```bash
kubectl create ingress web-ingress --rule="foo.com/bar=svc1:5000,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... |
Rename a context in your kubeconfig file. | Command:
```bash
kubectl config rename-context prod-context app-1-context
```
What it does:
Renames a context from the kubeconfig file.
CONTEXT_NAME is the context name that you want to change.
NEW_NAME is the new name you want to set.
Note: If the context being renamed is the 'current-context', this field will also b... |
Delete pods and services with the names "chat-app" and "database" | Command:
```bash
kubectl delete pod,service chat-app database
```
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 selecto... |
Add a taint with key 'workload' on nodes having label team=devops | Command:
```bash
kubectl taint node -l team=devops workload=node-2: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": "Output ... |
Delete the pods and services with the names "api" and "auth" | Command:
```bash
kubectl delete pod,service api auth
```
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.
Some r... |
Import environment variables from a config map with a prefix for a specific deployment | Command:
```bash
kubectl set env --from=configmap/app-settings --prefix=MYSQL_ deployment/analytics-platform-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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.