prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a new config map named app-config from the key=value pairs in the file | Command:
```bash
kubectl create configmap app-config --from-file=path/to/profiles
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basename o... |
Disable certificate checking for the "sun-cluster" entry in the Kubernetes configuration. | Command:
```bash
kubectl config set-cluster sun-cluster --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] [--certificate... |
Create a debug copy of the 'web-app-pod', replacing all container images with 'mongo' and name it 'debug-image-1'. | Command:
```bash
kubectl debug web-app-pod --copy-to=debug-image-1 --set-image=*=mongo
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resourc... |
create a job with an image and a command | Command:
```bash
kubectl create job log-collection --image=golang -- go run hello.go
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output f... |
Start a nginx pod in the foreground and do not restart it if it exits | Command:
```bash
kubectl run -i -t busybox --image=nginx --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...]`
Helpful flags:
"flag... |
Create a new secret named monitoring-credentials-secret using the environment variables defined in the path/to/profiles.env file. | Command:
```bash
kubectl create secret generic monitoring-credentials-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 defau... |
List the supported API resources for a specific API group | Command:
```bash
kubectl api-resources --api-group=autoscaling
```
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 an ingress called 'api-gateway-ingress' to direct requests from site.com/module to svc1:27017 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="site.com/module=svc1:27017,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 deployment named "wordpress" using the "wordpress" image and expose port 5001 | Command:
```bash
kubectl create deployment wordpress --image=wordpress --port=5001
```
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... |
Update the annotation of a pod with a new value, overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods chat-app last-deployment='2023-03-15'
```
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 ... |
Create a copy of the 'monitoring-pod' pod and add a debug container to it | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=my-debugger --image=debian --set-image=web=nginx:latest,mailer=mailer:latest
```
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 an ingress resource called 'app1-ingress' that directs requests from website.com/example to the service named 'svc1' on port 8181, with a TLS certificate named "my-cert". | Command:
```bash
kubectl create ingress app1-ingress --rule="website.com/example=svc1:8181,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... |
Check the rollout status of a specific daemonset named "app-v2" | Command:
```bash
kubectl rollout status daemonset/app-v2
```
What it does:
Manage the rollout of a resource.
Valid resource types include:
Syntax:
`kubectl rollout SUBCOMMAND` |
Create a new config map named app-config-dev based on the profiles folder. | Command:
```bash
kubectl create configmap app-config-dev --from-file=path/to/profiles
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basena... |
List the deployments in YAML output format from the "extensions" API group, in the version "v1.1.1". | Command:
```bash
kubectl get deployments.v1.1.1.extensions -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will... |
List deployments in YAML format from the "custom-deployments" API group, using version "v2.1.0" | Command:
```bash
kubectl get deployments.v2.1.0.custom-deployments -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 ... |
Update the 'monitoring' pod by removing the label named 'bar' if it exists. | Command:
```bash
kubectl label pods monitoring tier-
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "If t... |
Remove a taint from a specific node | Command:
```bash
kubectl taint nodes backup-node-14 disktype: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 ... |
Forward local traffic on port 3000 to port 6379 in the 'email-server-deployment' deployment | Command:
```bash
kubectl port-forward deployment/email-server-deployment 3000 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... |
Open a raw terminal connection to the 'code-explorer' container in the 'e-commerce-pod' pod, allowing you to interact with the 'bash' shell. | Command:
```bash
kubectl attach e-commerce-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 om... |
Create a copy of the 'web-app-pod' and name it 'debug-image-1', while changing all container images to 'wordpress' | Command:
```bash
kubectl debug web-app-pod --copy-to=debug-image-1 --set-image=*=wordpress
```
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 res... |
create an external service named external-dns-service with the external name museum-example.museum | Command:
```bash
kubectl create service externalname external-dns-service --external-name museum-example.museum
```
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 reference se... |
Expose a pod as a service with a specific name and port | Command:
```bash
kubectl expose pod api-service-pod --port=5432 --name=frontend
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified ... |
import the DEBUG_MODE key from the db-config config map and set it as an environment variable for the log-aggregator-deployment deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/db-config deployment/log-aggregator-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... |
Set custom TLS server name for cluster-beta cluster entry | Command:
```bash
kubectl config set-cluster cluster-beta --tls-server-name=cloud-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] [--certificat... |
import the environment variables with the prefix MYSQL_ from the config map kube-system-config and apply them to the cache-cluster-deployment deployment | Command:
```bash
kubectl set env --from=configmap/kube-system-config --prefix=MYSQL_ deployment/cache-cluster-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... |
Copy the file '/tmp/foo' from the remote pod 'kube-flannel/image-resizer-pod-20' to the local directory '/tmp/bar_dir' | Command:
```bash
kubectl cp kube-flannel/image-resizer-pod-20::/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... |
Forward traffic from port 8080 on localhost and IP 10.19.21.23 to port 6379 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-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 th... |
Create a pod disruption budget named elastic-search-pdb that will select all pods with the version=v2 label and require minimum one of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget elastic-search-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 Pod Disruption Budget named api-service-pdb that will select all pods with the tier=frontend label and require a minimum of four of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget api-service-pdb --selector=tier=frontend --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 ... |
Forward traffic from local port 9090 to port 8081 on the selected pod | Command:
```bash
kubectl port-forward deployment/authentication-service-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, ... |
import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/namespace-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... |
Forward traffic from port 3000 on localhost and IP 10.19.21.23 to port 8080 in the pod named "cdn-service-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 3000: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 cri... |
Forward traffic from local port 8081 to port 8888 on a pod selected by the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8081 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 ... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/app-config-dev deployment/web-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 definitions ... |
Set or update the annotation 'last-deployment' with the value '2023-03-15' for the pod named 'api', replacing any existing value. | Command:
```bash
kubectl annotate --overwrite pods api last-deployment='2023-03-15'
```
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 i... |
Scale the deployment "media-stream" to have a minimum of 1 pod and a maximum of 13 pods, without specifying a target CPU utilization. | Command:
```bash
kubectl autoscale deployment media-stream --min=1 --max=13
```
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... |
Update the environment variable of deployment 'order-processing-deployment' | Command:
```bash
kubectl set env deployment/order-processing-deployment REDIS_HOST=redis-server
```
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... |
Remove the taint with key 'workload' and effect 'NoSchedule' from the node named 'monitoring-node-15' if it exists | Command:
```bash
kubectl taint nodes monitoring-node-15 workload:NoSchedule-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. ... |
Create a new config map named app-settings from the key=value pairs in the specified file | Command:
```bash
kubectl create configmap app-settings --from-file=path/to/settings
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basename... |
Embed the certificate authority data for the 'testing-cluster' cluster entry using the command 'kubectl config set-cluster testing-cluster --embed-certs --certificate-authority=~/.kube/moon-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster testing-cluster --embed-certs --certificate-authority=~/.kube/moon-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 ... |
Update the pod 'gateway' with a label 'status=unhealthy', only if the pod's resource version is unchanged from version 1. | Command:
```bash
kubectl label pods gateway status=unhealthy --resource-version=1
```
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", "defa... |
create a ClusterIP service named analytics-service-clusterip that maps port 3001 on the cluster to port 5000 on the service. | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=3001:5000
```
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": "-... |
Set the custom TLS server name to "staging-cluster" for the "on-prem-cluster" cluster entry in the kubeconfig file | Command:
```bash
kubectl config set-cluster on-prem-cluster --tls-server-name=staging-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] [--certi... |
Copy the file /tmp/foo from a remote pod to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp kube-dns/message-broker-pod-15:/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... |
Copy the file `~/.config/kube` from the remote pod `velero/auth-service-pod-11` to the local directory `:/tmp/bar` | Command:
```bash
kubectl cp velero/auth-service-pod-11:~/.config/kube :/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 ... |
Update the label of pod 'api' with the label 'role' and value 'backend' | Command:
```bash
kubectl label pods api role=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... |
Set the 'cluster' field in the 'team-beta-context' context to 'edge-cluster'. | Command:
```bash
kubectl config set contexts.team-beta-context.cluster edge-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... |
Remove the annotation named 'description' from the pod 'analytics' | Command:
```bash
kubectl annotate pods analytics description-
```
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... |
Forward traffic from port 8088 on all addresses to port 9090 in the api-service-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 8088: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 w... |
Create an ingress resource with a default backend that handles all requests for an unspecified host or path | Command:
```bash
kubectl create ingress ingdefault --class=default \
--default-backend=defaultsvc:http \
--rule="foo.com/*=svc:3000,tls=secret1"
```
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": "--ou... |
Update the label of a pod named 'backend' with the label 'env' and the value 'production' | Command:
```bash
kubectl label pods backend env=production
```
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":... |
Create a new config map named app-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config --from-file=properties=/path/to/data/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 creating... |
Forward port 8081 on localhost and IP 10.19.21.23 to port 6379 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8081: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 ... |
Forward traffic from local port 8080 to port 8080 in the web-app-pod, listening on all addresses. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8080:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Create a single ingress resource called 'public-service-ingress' that directs requests to 'foo.com/module' to the service named 'svc1' running on port 3001 | Command:
```bash
kubectl create ingress public-service-ingress --rule="foo.com/module=svc1:3001,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": "",... |
configure auto scaling for the replication controller "analytics" with a target CPU utilization of 20%, allowing the number of pods to scale between 1 and 4. | Command:
```bash
kubectl autoscale rc analytics --max=4 --cpu-percent=20
```
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 us... |
Create a copy of the analytics-pod with a debug container and change the container images | Command:
```bash
kubectl debug analytics-pod -it --copy-to=my-custom-dbg --image=debian --set-image=worker=my-custom-worker:1.2.3,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 resourc... |
Retrieve the previous terminated logs of the "rocket-ranger" container in the "payment-gateway-pod" pod. | Command:
```bash
kubectl logs -p -c rocket-ranger payment-gateway-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... |
Check if you have permission to list the job named "image-processing-job" in namespace "namespace-1" | Command:
```bash
kubectl auth can-i list jobs.batch/image-processing-job -n namespace-1
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a parti... |
Add a taint with key 'environment' on nodes having label project=project-alpha | Command:
```bash
kubectl taint node -l project=project-alpha environment=prod-node-5:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
List deployments in the JSON output format for the "rc-1.1.0" version of the "my-apps" API group | Command:
```bash
kubectl get deployments.rc-1.1.0.my-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 will ... |
Create a new service account named 'default' | Command:
```bash
kubectl create serviceaccount default
```
What it does:
Create a service account with the specified name.
Syntax:
`kubectl create serviceaccount NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-te... |
List the resources of type "ReplicationController" with the name "web", the resources of type "Service" with the name "log-aggregator-rc", and the resource of type "Pod" with the name "media-stream-pod". | Command:
```bash
kubectl get rc/web service/log-aggregator-rc pods/media-stream-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is na... |
Copy the file "/tmp/foo" from the remote pod "logging/logging-agent-pod-7" to the local directory "/etc/kubernetes" | Command:
```bash
kubectl cp logging/logging-agent-pod-7::/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 omitted, use th... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/proxy-server-pod 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 be selected a... |
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/preferences/file1.txt --from-file=key1=/path/to/settings/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 cr... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/log-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 definitions in ... |
Return the snapshot logs from the container database-deployment-1 of the e-commerce-pod deployment. | Command:
```bash
kubectl logs deployment/database-deployment -c e-commerce-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":... |
Import the specified keys from a config map into the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/log-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 defi... |
Create a new config map named kube-system-config using the key=value pairs from the file located at 'path/to/profiles' | Command:
```bash
kubectl create configmap kube-system-config --from-file=path/to/profiles
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the ba... |
Create a service for the replicated ubuntu resource, which serves on port 8080 and connects to the containers on port 30000. | Command:
```bash
kubectl expose rc ubuntu --port=8088 --target-port=300000
```
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.... |
Update the app version of a pod specified in the "settings.json" file | Command:
```bash
kubectl annotate -f settings.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 arbitrar... |
Remove the taint with key 'environment' and effect 'NoSchedule' from the node 'worker-node-3' if it exists. | Command:
```bash
kubectl taint nodes worker-node-3 environment: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. On... |
Add the annotation 'security-scan-status' with the value 'pass' to the 'backend' pod. | Command:
```bash
kubectl annotate pods backend security-scan-status=pass
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbi... |
Import the 'database_url' key from the config map 'ui-config' into the deployment 'cache-cluster-deployment' | Command:
```bash
kubectl set env --keys=database_url --from=configmap/ui-config deployment/cache-cluster-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... |
Create a pod disruption budget named ingress-controller-pdb that will select all pods with the component=web label and require at least one of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget ingress-controller-pdb --selector=component=web --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-avail... |
Rename the context 'dev-context' to 'user-b-context' in your kubeconfig file | Command:
```bash
kubectl config rename-context dev-context user-b-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... |
Enable auto scaling for the deployment named "backend", with a minimum of 4 pods and a maximum of 13 pods. | Command:
```bash
kubectl autoscale deployment backend --min=4 --max=13
```
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 copy of the mypod pod, changing the command of the nebula-navigator container, and launch an interactive shell in the copied pod named debug-image-web in the default namespace. | Command:
```bash
kubectl debug mypod -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 by defaul... |
Forward local port 3000 to port 3000 in the chat-app-pod pod | Command:
```bash
kubectl port-forward pod/chat-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 autom... |
Forward local port 8888 to pod port 8088 for a web app pod. | Command:
```bash
kubectl port-forward pod/web-app-pod 8888 8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Create a pod named "hazelcast" using the "hazelcast/hazelcast" image and expose port 9092 | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=9092
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:... |
Execute the 'kafka-console-producer --broker-list localhost:9092 --topic test' command in the warp-drive container of the pod named proxy-server-pod | Command:
```bash
kubectl exec proxy-server-pod -c warp-drive -- 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": "-c"... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/kube-system-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 defini... |
Import environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/docker-registry-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... |
Print the result of updating the jenkins container limits to CPU=200m and Memory=512Mi from a local file in yaml format. | Command:
```bash
kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may ... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/app-config-dev 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 definitio... |
List the replication controller, service, and pod with the names 'web', 'chat-app-rc', and 'frontend-pod', respectively. | Command:
```bash
kubectl get rc/web service/chat-app-rc pods/frontend-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced y... |
Create a service for the replicated hazelcast, serving on port 8082, and connecting to the hazelcast containers on port 637900. | Command:
```bash
kubectl expose rc hazelcast --port=8082 --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 specified po... |
Create a new config map called log-config using files as the source for the configuration values | Command:
```bash
kubectl create configmap log-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/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... |
Return snapshot logs from container frontend-pod-1 of a deployment named monitoring-stack-deployment | Command:
```bash
kubectl logs deployment/monitoring-stack-deployment -c frontend-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:
"... |
Import the 'CONFIG_FILE_PATH' key from the 'kube-system-config' ConfigMap into the 'email-server-deployment' deployment. | Command:
```bash
kubectl set env --keys=CONFIG_FILE_PATH --from=configmap/kube-system-config deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variab... |
Create a pod disruption budget named replica-set-pdb that selects all pods with the role=worker label and guarantees that at least one of them is available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=role=worker --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 [-... |
Update the annotation 'team' of the pod 'media-stream' with the value 'frontend team' | Command:
```bash
kubectl annotate pods media-stream team='frontend team'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbi... |
Add a taint with key 'disktype' on nodes having label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 disktype=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"... |
Forward port 3000 on all addresses to port 8088 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 3000:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Switch to raw terminal mode and attach to the auth-service-pod container named quantum-quark | Command:
```bash
kubectl attach auth-service-pod -c quantum-quark -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 ... |
Get the output of the 'php --version' command from the 'cdn-service-pod' pod. | Command:
```bash
kubectl exec cdn-service-pod -- php --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 kub... |
Add a taint with key 'zone' and no value to the node 'web-node-8'. | Command:
```bash
kubectl taint nodes web-node-8 zone: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: json|... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.