prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Scale down the deployment named mysql to 1 replica, if its current size is 3. | Command:
```bash
kubectl scale --current-replicas=3 --replicas=1 deployment/mysql
```
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 --resource-version is sp... |
Auto scale the 'backend' replication controller with the number of pods between 1 and 5, targeting a CPU utilization of 60% | Command:
```bash
kubectl autoscale rc backend --max=5 --cpu-percent=60
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Display the supported API resources sorted by the 'group' column | Command:
```bash
kubectl api-resources --sort-by=group
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Create a service for the replication controller specified in the "ruby-controller.yaml" file | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=8443 --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 s... |
Get the output from running the 'go' command inside the 'e-commerce-pod' pod, using the first container by default | Command:
```bash
kubectl exec e-commerce-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.kuberne... |
forward the local port 3000 to the 8088 port of the 'mypod' pod | Command:
```bash
kubectl port-forward pod/mypod 3000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=debug_mode --from=configmap/app-settings 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 defi... |
Auto scale the deployment "database" with the number of pods between 4 and 15. | Command:
```bash
kubectl autoscale deployment database --min=4 --max=15
```
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... |
Create a single ingress called 'frontend-ingress' that directs requests to site.com/input to svc1:8083 with a tls secret called "my-cert" | Command:
```bash
kubectl create ingress rontend-ingress --rule="site.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... |
Execute the command 'mysql --version' in the time-machine container of the pod named frontend-pod and print the output. | Command:
```bash
kubectl exec frontend-pod -c time-machine -- 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 omitt... |
Execute the command 'dotnet --list-runtimes' in the 'nano-bot' container of the 'mypod' pod and display the output. | Command:
```bash
kubectl exec mypod -c nano-bot -- dotnet --list-runtimes
```
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, ... |
Stream the logs of the lunar-launcher container in the media-stream-pod pod | Command:
```bash
kubectl logs -f -c lunar-launcher media-stream-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 a new secret named password-secret using values from an environment file | Command:
```bash
kubectl create secret generic password-secret --from-env-file=path/to/properties.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 the ba... |
Taint nodes with a label 'namespace=mynamespace' with a taint key 'workload=worker-node-3:PreferNoSchedule' | Command:
```bash
kubectl taint node -l namespace=mynamespace workload=worker-node-3: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 streaming the logs of the 'nano-bot' container in the 'proxy-server-pod' pod. | Command:
```bash
kubectl logs -f -c nano-bot 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", "sh... |
Delete pods and services with names "email" and "gateway" | Command:
```bash
kubectl delete pod,service email gateway
```
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.
S... |
create a service for the hazelcast replication controller specified in hazelcast-controller.yaml, serving on port 5000 and connecting to the containers on port 909100 | Command:
```bash
kubectl expose -f hazelcast-controller.yaml --port=5000 --target-port=909100
```
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 ... |
Access an interactive Ruby shell in the container named 'mycontainer' of pod 'media-stream-pod' | Command:
```bash
kubectl exec media-stream-pod -c mycontainer -- 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 t... |
Import the MAX_CONNECTIONS key from the global-config config map into the database-deployment deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/global-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 definit... |
Listen on port 8081 locally and forward the traffic to port 8088 in the mypod pod. | Command:
```bash
kubectl port-forward pod/mypod 8081:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automaticall... |
import the 'log_level' key from the 'app-config-prod' config map and set it as an environment variable in the 'notification-handler-deployment' deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-config-prod 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... |
Create a new ExternalName service named external-notification-service | Command:
```bash
kubectl create service externalname external-notification-service --external-name governmental-demo.gov
```
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... |
Use the emacs editor to edit the 'loadbalancer-service' service | Command:
```bash
KUBE_EDITOR="emacs" kubectl edit svc/loadbalancer-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 var... |
Set the service account of the deployment "notification-handler-deployment" to "cert-manager" | Command:
```bash
kubectl set serviceaccount deployment notification-handler-deployment cert-manager
```
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
S... |
Retrieve information about a specific context in your kubeconfig file. | Command:
```bash
kubectl config get-contexts cluster-1-context
```
What it does:
Display one or many contexts from the kubeconfig file.
Syntax:
`kubectl config get-contexts [(-o|--output=)name)]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: name " |
Expose a replication controller named 'hazelcast' on port 8888, which will connect to containers on port 543200. | Command:
```bash
kubectl expose rc hazelcast --port=8888 --target-port=543200
```
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 po... |
Run a proxy to the Kubernetes API server on port 8443, and serve the static content from the `./local/www/` directory. | Command:
```bash
kubectl proxy --port=8443 --www=./local/www/
```
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... |
listen on ports 8081 and 6000 locally and forward data to/from ports 8080 and 6000 in a pod selected by the 'notification-handler-deployment' deployment | Command:
```bash
kubectl port-forward deployment/notification-handler-deployment 8081 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 ... |
Delete the pods and services with the names "cdn" and "frontend" | Command:
```bash
kubectl delete pod,service cdn frontend
```
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.
So... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/app-config 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 variable d... |
Retrieve the list of Kafka topics from the payment-gateway-pod using the quantum-quark container. | Command:
```bash
kubectl exec payment-gateway-pod -c quantum-quark -- 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... |
Get the documentation of a specific field of a resource | Command:
```bash
kubectl explain resource=services.status.podIP
```
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 ... |
Create a new ClusterIP service named 'order-service-clusterip' that maps port 8000 on the cluster to port 3001 on the service. | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=8000:3001
```
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 an ingress named 'ingress1' with multiple hosts and the pathType set to Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:27017" \
--rule="example.com/admin*=svc2:http"
```
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"... |
Create a new ClusterIP service named 'analytics-service-clusterip' with port mapping from local port 3001 to pod port 8888. | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=3001:8888
```
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": "-... |
Create a copy of the media-stream-pod with the command of lunar-launcher, for debugging purposes. | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-app --container=lunar-launcher -- 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 ... |
Create an ingress called 'website-ingress' that directs requests to the URL 'website.com/bar' to the service 'svc1' running on port '5000' using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress website-ingress --rule="website.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": "", "usag... |
Create an ingress resource named 'public-api-ingress' with a rule that directs requests from 'site.com/example' to service 'svc1' on port 3000, using the TLS secret named 'my-cert' | Command:
```bash
kubectl create ingress public-api-ingress --rule="site.com/example=svc1:3000,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": "", "... |
Execute the 'kafka-console-producer --broker-list localhost:9092 --topic test' command inside the 'rocket-ranger' container of the 'api-service-pod' pod to get the output. | Command:
```bash
kubectl exec api-service-pod -c rocket-ranger -- kafka-console-producer --broker-list localhost:9092 --topic test
```
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": "-... |
Create an ingress resource called 'website-ingress' that routes requests to 'website.com/input' to service 'svc1' running on port 5000 | Command:
```bash
kubectl create ingress website-ingress --rule="website.com/input=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": "", "us... |
Retrieve the logs from the previous terminated "cosmic-container" container in the "media-stream-pod" pod. | Command:
```bash
kubectl logs -p -c cosmic-container media-stream-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": "--contain... |
Forward port 8088 on all addresses to port 5000 in the backend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8088:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Add a taint with key 'hardware' on nodes having label environment=production, specifically on the edge-node-10 node and set it to PreferNoSchedule | Command:
```bash
kubectl taint node -l environment=production hardware=edge-node-10: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 environment variables from the 'ldap-credentials-secret' secret into the 'email-server-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/ldap-credentials-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 ... |
Forward local ports to a pod's ports | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8088 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 selected... |
Retrieve the snapshot logs from the container with the name "email-service-pod-1" in the "scheduler-app-deployment" deployment. | Command:
```bash
kubectl logs deployment/scheduler-app-deployment -c email-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 role named "foo" with the ability to create pods and specify specific pod names and a load balancer as the resource. | Command:
```bash
kubectl create role foo --verb=create --resource=pods --resource-name=app-worker-1 --resource-name=load-balancer
```
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|clien... |
Remove the taint with key 'dedicated' and effect 'NoSchedule' from node 'web-node-8' if it exists | Command:
```bash
kubectl taint nodes web-node-8 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:... |
Get output from running the 'wp' command in cyber-sleuth from the security-service-pod. | Command:
```bash
kubectl exec security-service-pod -c cyber-sleuth -- 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, u... |
Create a service for the replication controller specified in 'ruby-controller.yaml' | Command:
```bash
kubectl expose -f ruby-controller.yaml --port=80 --target-port=637900
```
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 spe... |
Import the SMTP_SERVER key from the monitoring-config ConfigMap and set it as an environment variable for the scheduler-app-deployment deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/monitoring-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable de... |
Apply the configuration in manifest.yaml file that matches the label namespace=mynamespace, and delete all other resources not in the file and match the label app=nginx. | Command:
```bash
kubectl apply --prune -f manifest.yaml -l namespace=mynamespace
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'app... |
Set the resource request and limits for all containers in the 'centos' deployment | Command:
```bash
kubectl set resources deployment centos --limits=cpu=200m,memory=512Mi --requests=cpu=10,memory=512Mi
```
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... |
List deployments in YAML output format from the "alpha-2.0" version of the "testing-apps" API group. | Command:
```bash
kubectl get deployments.alpha-2.0.testing-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... |
Retrieve the snapshot logs from the container named "proxy-service-deployment-1" in the "proxy-service-pod" deployment | Command:
```bash
kubectl logs deployment/proxy-service-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 flags:... |
Create a pod disruption budget named 'web-app-pdb' that selects all pods with the 'env=production' label and requires a minimum of 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget web-app-pdb --selector=env=production --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-available=N [--... |
Begin streaming the logs of the time-machine container in the proxy-server-pod pod. | Command:
```bash
kubectl logs -f -c time-machine 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",... |
Create an ingress called 'private-api-ingress' that directs requests to a specific path and service with TLS enabled. | Command:
```bash
kubectl create ingress private-api-ingress --rule="site.com/bar=svc1:8000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Update the deployment 'cache-cluster-deployment' by adding a new environment variable named "DB_PASSWORD" with the value "secretpassword" | Command:
```bash
kubectl set env deployment/cache-cluster-deployment DB_PASSWORD=secretpassword
```
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 po... |
Create a new config map named 'kube-system-config' with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap kube-system-config --from-file=properties=/path/to/configs/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 crea... |
Update the image of all containers in the 'app-v2' daemonset to 'python:3.9.7'. | Command:
```bash
kubectl set image daemonset app-v2 *=python:3.9.7
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:
`kube... |
Forward port 3000 from the pod to port 3000 locally | Command:
```bash
kubectl port-forward pod/web-app-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... |
Listen on port 8000 on your local machine and forward traffic to port 8888 in the 'chat-app-pod' pod | Command:
```bash
kubectl port-forward pod/chat-app-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 criteria, a pod will be selected autom... |
Import environment from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/cert-manager-secret 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 variable definitions in ... |
Create a new secret named aws-credentials-secret with keys for each file in the folder "path/to/properties" | Command:
```bash
kubectl create secret generic aws-credentials-secret --from-file=path/to/properties
```
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 bas... |
Copy the local file "~/.config/kube" to the remote pod "monitoring-agent-pod-6" in the "rook-ceph" namespace, and place it in the "/tmp/bar" directory. | Command:
```bash
kubectl cp ~/.config/kube rook-ceph/monitoring-agent-pod-6::/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... |
Update the annotation "app-version" of a pod to version 2.5.1. | Command:
```bash
kubectl annotate -f pod.json app-version=2.5.1
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbitrary str... |
Remove the "client-secret" configuration value for the OpenID Connect auth provider for the "system" entry. | Command:
```bash
kubectl config set-credentials system --auth-provider=oidc --auth-provider-arg=client-secret-
```
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=... |
Create a ClusterIP service named order-service-clusterip, which maps port 27017 on the service to port 9090 on the application | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=27017: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 config map named 'global-config' with the 'properties' key sourced from the '/path/to/configurations/file1.txt' file and the 'key1' key sourced from the '/path/to/configurations/file2.txt' file. | Command:
```bash
kubectl create configmap global-config --from-file=properties=/path/to/configurations/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.
... |
Create an ingress named 'default-ingress' that routes requests to foo.com/module to svc1:9000, using the tls secret 'my-cert' | Command:
```bash
kubectl create ingress default-ingress --rule="foo.com/module=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... |
Start a hazelcast pod with the image hazelcast/hazelcast and keep it running in the foreground without restarting if it exits. | Command:
```bash
kubectl run -i -t busybox --image=hazelcast/hazelcast --restart=Never
```
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...]`
Helpfu... |
Get deployments in YAML output format for the "rc-1.1.0" version of the "third-party-apps" API group | Command:
```bash
kubectl get deployments.rc-1.1.0.third-party-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 ... |
Forward traffic from port 8888 on all addresses to port 8888 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8888: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 ... |
Import the LOG_LEVEL key from the app-config-dev config map and set it as an environment variable for the monitoring-stack-deployment deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --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 variable defi... |
Set the custom TLS server name for the data-cluster cluster entry | Command:
```bash
kubectl config set-cluster data-cluster --tls-server-name=cluster-alpha
```
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... |
Create a new config map named env-vars with the specified key-value pairs | Command:
```bash
kubectl create configmap env-vars --from-file=settings=/path/to/configs/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 creating a co... |
Copy the local file /tmp/foo to the remote pod named security-scanner-pod-18 in the prometheus namespace and save it as /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo prometheus/security-scanner-pod-18::/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 th... |
Add a taint with key 'zone' and value 'node-2:PreferNoSchedule' on nodes having label 'cluster=my-cluster' | Command:
```bash
kubectl taint node -l cluster=my-cluster zone=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": "Outp... |
Copy the file "/tmp/foo" from your local machine to the "/tmp/bar" directory inside the pod named "file-server-pod-14" in the "logging" namespace. | Command:
```bash
kubectl cp /tmp/foo logging/file-server-pod-14:/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... |
create a job named database-seeding-job with the nginx image and run the command "nginx" inside the job | Command:
```bash
kubectl create job database-seeding-job --image=nginx -- nginx
```
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... |
Forward traffic from port 8088 on all addresses to port 5432 in the web-app-pod pod, using the command `kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8088:5432`. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8088: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 ... |
Create a new NodePort service named 'ingress-controller-nodeport' that listens on port 8000 and forwards traffic to port 8081 | Command:
```bash
kubectl create service nodeport ingress-controller-nodeport --tcp=8000:8081
```
What it does:
Create a NodePort service with the specified name.
Syntax:
`kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "de... |
Import the environment variables from the 'api-key-secret' secret and apply them to the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/api-key-secret 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 definitions in one o... |
Run the 'jenkins --version' command in the e-commerce-pod pod and display the output | Command:
```bash
kubectl exec e-commerce-pod -- 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. If omitted, use the ... |
Update the cluster field in the 'client-1-context' context to 'staging-cluster' | Command:
```bash
kubectl config set contexts.client-1-context.cluster staging-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 ... |
Scale the deployment named staging-app-rs from the current size of 7 replicas to 1 replica. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=1 deployment/staging-app-rs
```
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 --resource-vers... |
Remove the k8s-admin user from the kubectl configuration. | Command:
```bash
kubectl config delete-user k8s-admin
```
What it does:
Delete the specified user from the kubeconfig.
Syntax:
`kubectl config delete-user NAME` |
Import the environment variables from the 'ssl-key-secret' secret and set them in the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/ssl-key-secret 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 definitions in one or more pod t... |
Get output from the nebula-navigator container in the analytics-pod | Command:
```bash
kubectl attach analytics-pod -c nebula-navigator
```
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 omitte... |
Listen on the local port 8081 and forward traffic to port 3000 in the pod named 'mypod'. | Command:
```bash
kubectl port-forward pod/mypod 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 criteria, a pod will be selected automaticall... |
Create a debuggable copy of the cdn-service-pod with the command of nebula-navigator changed. | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=debug-image-web --container=nebula-navigator -- 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... |
Add a taint with the key 'dedicated' on nodes having the label owner=john-doe. | Command:
```bash
kubectl taint node -l owner=john-doe dedicated=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": ... |
Forward traffic from port 3000 on all addresses to port 8088 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 3000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-secrets 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 defi... |
Create a deployment named "db" using the "ubuntu" image and expose port "8000" | Command:
```bash
kubectl create deployment db --image=ubuntu --port=8000
```
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|... |
Use the 'micro' editor to edit the 'api-service' service configuration | Command:
```bash
KUBE_EDITOR="micro" 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, o... |
Forward local port 8088 to the pod selected by the web-app-deployment on port 8088. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 8088 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 s... |
Import the 'DEBUG_MODE' key from the 'monitoring-config' config map into the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/monitoring-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 variabl... |
Create a debug session for the proxy-service-pod pod by launching a shell in the cyber-sleuth container | Command:
```bash
kubectl debug proxy-service-pod -it --copy-to=my-custom-dbg --container=cyber-sleuth -- 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 by ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.