prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Set the service account of the deployment named api-server-deployment to kube-proxy | Command:
```bash
kubectl set serviceaccount deployment api-server-deployment kube-proxy
```
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:
`kube... |
Create a NodePort service named "e-commerce-nodeport" that maps port 3001 of the cluster to port 8000 of the service. | Command:
```bash
kubectl create service nodeport e-commerce-nodeport --tcp=3001:8000
```
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", "default": ... |
Import specific keys from a config map to the environment variables of a deployment | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/namespace-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 definitio... |
Taint nodes with a specific label to prevent scheduling on them | Command:
```bash
kubectl taint node -l cluster=my-cluster cpu-type=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Create a service for the replicated 'ubuntu' pods, which serves on port 9091 and connects to the containers on port 909200 | Command:
```bash
kubectl expose rc ubuntu --port=9091 --target-port=909200
```
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 single ingress called 'api-gateway-ingress' that directs requests to site.com/example to svc1:7000 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="site.com/example=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": "", ... |
Embed the certificate authority data for the "kube-cluster-1" cluster entry. | Command:
```bash
kubectl config set-cluster kube-cluster-1 --embed-certs --certificate-authority=~/.kube/staging-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 confi... |
Create a new ExternalName service named external-metrics-service that points to the external domain name "education-edu.edu". | Command:
```bash
kubectl create service externalname external-metrics-service --external-name education-edu.edu
```
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... |
Set the service account of the deployment "monitoring-stack-deployment" to "istio" | Command:
```bash
kubectl set serviceaccount deployment monitoring-stack-deployment istio
```
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:
`kub... |
Create a new config map named app-settings using specified keys from different files | Command:
```bash
kubectl create configmap app-settings --from-file=properties=/path/to/preferences/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 creati... |
Edit the job 'data-synchronization-job' in JSON format using the v1 API. | Command:
```bash
kubectl edit job.v1.batch/data-synchronization-job -o json
```
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 va... |
Copy a directory from a remote pod to a local directory | Command:
```bash
kubectl cp kube-flannel/api-server-pod-3:/tmp/foo_dir :/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the... |
Update the 'gateway' pod with the annotation 'env' and the value 'staging', making sure to overwrite any existing value. | Command:
```bash
kubectl annotate --overwrite pods gateway env='staging'
```
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... |
Set a custom TLS server name for the "cloud-cluster" cluster entry in the kubeconfig file. | Command:
```bash
kubectl config set-cluster cloud-cluster --tls-server-name=sun-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate... |
Forward local port 8888 to port 8000 in the pod named 'proxy-server-pod'. | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8888:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Create a copy of the 'monitoring-pod' pod and launch a debug container in it | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-api --image=debian --set-image=cache=redis:alpine,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 na... |
Add a taint with the key 'zone' and the value 'storage-node-13:PreferNoSchedule' on nodes having the label 'region=eu-west-2' | Command:
```bash
kubectl taint node -l region=eu-west-2 zone=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Get the output by running the 'apache2ctl -D FOREGROUND' command from the log-aggregator-pod. | Command:
```bash
kubectl exec log-aggregator-pod -- apache2ctl -D FOREGROUND
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Partially update the node named node-2 by providing a strategic merge patch in YAML format | Command:
```bash
kubectl patch node node-2 -p $'spec:\n rules:\n- http:\n paths:\n - path: /\n backend:\n service:\n name: new-service'
```
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:... |
Retrieve the output of the 'geth version' command from the nano-bot container running in the backend-pod | Command:
```bash
kubectl exec backend-pod -c nano-bot -- geth 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 ... |
Copy the local file /tmp/foo to the remote pod ingress-controller-pod-8 in the kube-public namespace, and save it as /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo kube-public/ingress-controller-pod-8:/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 t... |
Forward port 8888 on localhost and IP 10.19.21.23 to port 3000 in the pod "proxy-server-pod" for debugging or accessing the service | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 8888: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 cr... |
Create an ingress called 'external-ingress' with a rule that directs requests from testing.com/module to the service svc1 on port 8000 | Command:
```bash
kubectl create ingress external-ingress --rule="testing.com/module=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": "", "... |
Copy the local file `/tmp/foo_dir` to the remote pod `metrics-exporter-pod-10` in the `/tmp/bar` directory, specifically in the `front-end` container. | Command:
```bash
kubectl cp /tmp/foo_dir metrics-exporter-pod-10::/tmp/bar -c front-end-container
```
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... |
apply all resources defined in the settings directory using the configuration specified in the kustomization.yaml file | Command:
```bash
kubectl apply -k settings/
```
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 'apply' or 'create --save-config'.
JSON a... |
Forward the traffic from port 3000 on localhost and IP 10.19.21.23 to port 8888 in the pod named 'log-aggregator-pod' | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 3000: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 ... |
Import specific keys from a config map. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --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 variable de... |
Update the deployment 'scheduler-app-deployment' by adding a new environment variable named MAX_CONNECTIONS with the value 100. | Command:
```bash
kubectl set env deployment/scheduler-app-deployment MAX_CONNECTIONS=100
```
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 templ... |
Create an ingress with TLS enabled, using the default ingress certificate and different path types | Command:
```bash
kubectl create ingress ingtls --class=default \
--rule="site.com/=svc:https,tls" \
--rule="site.com/path/subpath*=othersvc:5000"
```
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": "--o... |
Import the MAX_CONNECTIONS key from the log-config config map into the database-deployment deployment | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/log-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 definition... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/app-config-prod deployment/email-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitio... |
Forward traffic from port 5432 on all addresses to port 8088 in the pod named api-service-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/api-service-pod 5432:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod w... |
Import the API_KEY from the env-vars config map to the scheduler-app-deployment deployment. | Command:
```bash
kubectl set env --keys=API_KEY --from=configmap/env-vars 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 definitions in ... |
Forward local traffic from port 9090 to port 8888 in the log-aggregator-deployment deployment | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 9090 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 wi... |
Create a deployment named "wordpress" with 7 replicas running the WordPress image | Command:
```bash
kubectl create deployment wordpress --image=wordpress --replicas=7
```
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. On... |
List all deployments in the "v2.0.0" version of the "my-apps" API group, and display the output in JSON format. | Command:
```bash
kubectl get deployments.v2.0.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 on... |
Create a deployment named 'db' using the 'postgres' image and expose port 9092. | Command:
```bash
kubectl create deployment db --image=postgres --port=9092
```
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: jso... |
Create a new ClusterIP service named order-service-clusterip that maps port 8181 on the service to port 9091 on the pods | Command:
```bash
kubectl create service clusterip order-service-clusterip --tcp=8181:9091
```
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 job named 'database-seeding-job' using the mysql image, with the command 'mysql' | Command:
```bash
kubectl create job database-seeding-job --image=mysql -- mysql
```
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... |
Auto scale the "payment" deployment with a range of pods between 6 and 8 | Command:
```bash
kubectl autoscale deployment payment --min=6 --max=8
```
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 ... |
Update the annotation 'last-deployment' of the 'auth' pod to have the value '2023-03-15', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods auth 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 ... |
Forward local port 8080 to port 5000 in the pod named web-app-pod | Command:
```bash
kubectl port-forward pod/web-app-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 automa... |
Add a taint to nodes with label app-type=microservice. | Command:
```bash
kubectl taint node -l app-type=microservice special=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":... |
Forward local port 8081 to port 8080 in the mypod pod | Command:
```bash
kubectl port-forward pod/mypod 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 pod will be selected automaticall... |
Set the service account of the deployment 'mydeployment' to 'kube-controller-manager'. | Command:
```bash
kubectl set serviceaccount deployment mydeployment kube-controller-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
Syntax:
`... |
Set environment variable "DB_PASSWORD" to "secretpassword" for all replication controllers in the project. | Command:
```bash
kubectl set env rc --all 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 pod templates (within replica... |
Import the specific keys "external_api_url" from the config map "kube-system-config" into the deployment "monitoring-stack-deployment" | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/kube-system-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 va... |
Set resource request and limits for all containers in the Kafka deployment | Command:
```bash
kubectl set resources deployment kafka --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=1Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requeste... |
Delete pods and services with the names "proxy-server" and "web" | Command:
```bash
kubectl delete pod,service proxy-server web
```
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... |
Get the output from running the 'elasticsearch' command in the 'cyber-sleuth' container from the 'email-service-pod' pod. | Command:
```bash
kubectl exec email-service-pod -c cyber-sleuth -- 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. If om... |
Listen on the local ports 6379 and 6000 and forward data to/from the respective ports in the 'cdn-service-pod' pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 6379 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Unset the namespace in the user-b-context context | Command:
```bash
kubectl config unset contexts.user-b-context.namespace
```
What it does:
Unset 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.
Syntax:
`kubectl config unset PROPERTY_NAME... |
Set the CPU limits of the MySQL container in a deployment to "200m" and the memory limits to "256Mi". | Command:
```bash
kubectl set resources deployment mysql -c=nginx --limits=cpu=200m,memory=256Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to... |
List the replication controller 'web', service 'vpn-service-rc', and pod 'monitoring-pod' | Command:
```bash
kubectl get rc/web service/vpn-service-rc pods/monitoring-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 namespa... |
Create a job named security-scan-job using the jenkins image, and run the command "java -jar /usr/share/jenkins/jenkins.war" as part of the job. | Command:
```bash
kubectl create job security-scan-job --image=jenkins -- java -jar /usr/share/jenkins/jenkins.war
```
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", "def... |
Create an ingress called 'rontend-ingress' that directs requests from testing.com/input to svc1:6379 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress rontend-ingress --rule="testing.com/input=svc1:6379,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "us... |
Set the service account of the deployment "database-deployment" to "default" | Command:
```bash
kubectl set serviceaccount deployment database-deployment default
```
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:
`kubectl s... |
Set a custom TLS server name for the on-prem-cluster cluster entry. | Command:
```bash
kubectl config set-cluster on-prem-cluster --tls-server-name=star-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] [--certific... |
Create a new config map named ui-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap ui-config --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/path/to/profiles/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 ... |
Import the 'database_url' key from the 'ui-config' config map and set it as an environment variable for the 'search-engine-deployment' deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/ui-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 definitio... |
Create a new config map named monitoring-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap monitoring-config --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/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... |
Create a cluster role named "default_role" with specific resource names | Command:
```bash
kubectl create clusterrole default_role --verb=get --resource=pods --resource-name=app-worker-1 --resource-name=nginx-proxy
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|n... |
Create an ingress named 'myapp-ingress' with a rule that directs requests to 'website.com/bar' to the service 'svc1' running on port '27017' | Command:
```bash
kubectl create ingress myapp-ingress --rule="website.com/bar=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": "", "usage... |
Copy the /tmp/foo_dir local file to /etc/kubernetes in the auth-service-pod-11 pod in the kube-proxy namespace | Command:
```bash
kubectl cp /tmp/foo_dir kube-proxy/auth-service-pod-11:/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, ... |
Listen on port 8088 locally and forward it to port 6379 in the pod named mypod. | Command:
```bash
kubectl port-forward pod/mypod 8088: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 automaticall... |
Edit the data in the 'config.json' file in JSON format, and create a resource using the edited data. | Command:
```bash
kubectl create -f config.json --edit -o json
```
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 ... |
Check if the current user has permission to list the jobs in the specified namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/content-import-job -n kube-dns
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a partial UR... |
Create an ingress named 'private-service-ingress' that redirects requests to 'website.com/bar' to 'svc1:9000' and uses the TLS secret 'my-cert'. | Command:
```bash
kubectl create ingress private-service-ingress --rule="website.com/bar=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": "... |
Check if you have permission to list the job named "certificates-renewal-job" in the "kube-ingress" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/certificates-renewal-job -n kube-ingress
```
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 ... |
Delete the pods and services named "proxy-server" and "log-aggregator" | Command:
```bash
kubectl delete pod,service proxy-server log-aggregator
```
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 lab... |
create a new ClusterIP service named payment-service-clusterip | Command:
```bash
kubectl create service clusterip payment-service-clusterip --tcp=5001:8181
```
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"... |
Add a taint with the key 'disktype' on nodes that have the label 'myLabel'. | Command:
```bash
kubectl taint node -l myLabel disktype=dev-node-4: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 ... |
Get output from `quantum-quark` container in `media-stream-pod` pod. | Command:
```bash
kubectl attach media-stream-pod -c quantum-quark
```
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... |
Set the cluster field in a specific context | Command:
```bash
kubectl config set contexts.team-beta-context.cluster data-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value yo... |
List the deployments in the "backup-apps" API group with YAML output format and version "v2.0.0" | Command:
```bash
kubectl get deployments.v2.0.0.backup-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 wil... |
Get the output from the Cosmic container running inside the backend-pod pod. | Command:
```bash
kubectl attach backend-pod -c cosmic-container
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
List deployments in JSON output format for the "backup-apps" API group in version "v2.0.0". | Command:
```bash
kubectl get deployments.v2.0.0.backup-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 wil... |
Create a deployment named 'prometheus' using the 'redis' image and expose port 9090 | Command:
```bash
kubectl create deployment prometheus --image=redis --port=9090
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of... |
Forward the port 8081 on your local machine to the targetPort of the "https" port in the pod selected by the "scheduler-service" service. | Command:
```bash
kubectl port-forward service/scheduler-service 8081:https
```
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 sele... |
Configure the web-cluster cluster entry with the certificate authority data by running the command "kubectl config set-cluster web-cluster --embed-certs --certificate-authority=~/.kube/kube-cluster-1/kubernetes.ca.crt" | Command:
```bash
kubectl config set-cluster web-cluster --embed-certs --certificate-authority=~/.kube/kube-cluster-1/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 se... |
view the rollout history of the development deployment | Command:
```bash
kubectl rollout history deployment/development
```
What it does:
View previous rollout revisions and configurations.
Syntax:
`kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files i... |
Create a new ClusterIP service named 'log-service-clusterip' that maps port 9090 on the service to port 8000 on the pods. | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=9090:8000
```
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", "d... |
Forward traffic from local port 5432 to port 8000 in the web-app-pod pod | Command:
```bash
kubectl port-forward pod/web-app-pod 5432 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Delete both the pod and service named "vpn" and the pod and service named "proxy-server" | Command:
```bash
kubectl delete pod,service vpn proxy-server
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector... |
Create a new config map named kube-system-config using the files in the path/to/options folder. | Command:
```bash
kubectl create configmap kube-system-config --from-file=path/to/options
```
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 bas... |
Listen on port 6379 on localhost and IP address 10.19.21.23, and forward the traffic to port 9090 in the e-commerce-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-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 the crit... |
Update a pod's annotation using a parameters file | Command:
```bash
kubectl annotate -f parameters.json git-repo='https://github.com/example/my-app'
```
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 tha... |
Copy the file "~/.config/kube" to the remote pod "message-broker-pod-15" in the "kube-system" namespace and place it in the "/tmp/bar" directory. | Command:
```bash
kubectl cp ~/.config/kube kube-system/message-broker-pod-15:/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
list resources from a directory specified in a kustomization.yaml file | Command:
```bash
kubectl get -k params/
```
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 only see results in your c... |
Create a new pod named "hazelcast" using the "amazonlinux" image, and configure the container within the pod to expose port 5001. | Command:
```bash
kubectl run hazelcast --image=amazonlinux --port=5001
```
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":... |
Use the vim editor to edit the gateway-service service. | Command:
```bash
KUBE_EDITOR="vim" kubectl edit svc/gateway-service
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables,... |
Create a copy of the gateway-pod and change all container images to hazelcast/hazelcast | Command:
```bash
kubectl debug gateway-pod --copy-to=debug-image-1 --set-image=*=hazelcast/hazelcast
```
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... |
Get the output from running the 'wp' command in the 'nebula-navigator' container inside the 'log-aggregator-pod' pod | Command:
```bash
kubectl exec log-aggregator-pod -c nebula-navigator -- 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 ports localhost:8088 to pod:3000 | Command:
```bash
kubectl port-forward deployment/mydeployment 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 selecte... |
Create a new config map named 'monitoring-config' with key1=config1 and key2=config2 | Command:
```bash
kubectl create configmap monitoring-config --from-literal=properties=config1 --from-literal=key1=config2
```
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... |
Update the pod identified by the type and name in the "pod.json" file by adding the annotation "team" with the value "frontend team" | Command:
```bash
kubectl annotate -f pod.json 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 arbitrary ... |
Retrieve the log snapshot of the previously terminated 'code-explorer' container from the 'security-service-pod' pod. | Command:
```bash
kubectl logs -p -c code-explorer security-service-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": "--contai... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-config deployment/gateway-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... |
Import the 'database_url' key from the 'log-config' config map and set it as an environment variable for the 'notification-handler-deployment' deployment. | Command:
```bash
kubectl set env --keys=database_url --from=configmap/log-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... |
Forward local port 8080 to port 9090 of a pod selected by the deployment | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 8080 9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.