prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Import the SECRET_KEY key from the log-config ConfigMap to the monitoring-stack-deployment Deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/log-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 definit... |
Update the cluster role binding for cert-manager, granting admin access to the specified service account in the given namespace. | Command:
```bash
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:cert-manager
```
What it does:
Update the user, group, or service account in a role binding or cluster role binding.
Syntax:
`kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=n... |
Create a new config map named kube-system-config using specified keys from the provided files | Command:
```bash
kubectl create configmap kube-system-config --from-file=conf=/path/to/parameters/file1.txt --from-file=data=/path/to/parameters/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... |
Set the resource requests and limits for all containers in the 'runtime' deployment to CPU=1, Memory=128Mi for requests, and CPU=200m, Memory=512Mi for limits. | Command:
```bash
kubectl set resources deployment runtime --limits=cpu=200m,memory=512Mi --requests=cpu=1,memory=128Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource request... |
Create a pod named "hazelcast" using the "node" image and expose port 8010 | Command:
```bash
kubectl run hazelcast --image=node --port=8010
```
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": "--fil... |
Add a taint with the key 'app' on nodes that have the label 'tier=frontend' | Command:
```bash
kubectl taint node -l tier=frontend app=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": "Output for... |
Autoscale the deployment "auth" with a minimum of 4 pods and a maximum of 14 pods | Command:
```bash
kubectl autoscale deployment auth --min=4 --max=14
```
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 th... |
Copy the local file `/tmp/foo_dir` to the remote pod `ingress-controller-pod-8` in the container named `database-container`, and save it as `/tmp/bar` | Command:
```bash
kubectl cp /tmp/foo_dir ingress-controller-pod-8::/tmp/bar -c database-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... |
Import specific keys from a config map in a deployment. | Command:
```bash
kubectl set env --keys=my-example-key --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 variable... |
Set the custom TLS server name "edge-cluster" to be used for validation for the "my-k8s-cluster" cluster entry | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=edge-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] [--certifica... |
Forward local traffic between ports 8081 and 8080 to a selected pod in the deployment for the database | Command:
```bash
kubectl port-forward deployment/database-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 pod will be ... |
Create a new service of type ExternalName named external-ldap-service that points to the external DNS name "document-company.com" | Command:
```bash
kubectl create service externalname external-ldap-service --external-name document-company.com
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference se... |
Get the output of the 'go' command from the first container of the first pod in the 'loadbalancer-service' service. | Command:
```bash
kubectl exec svc/loadbalancer-service -- 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 kubec... |
Rename a context in the kubeconfig file | Command:
```bash
kubectl config rename-context testing-context user-a-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 al... |
Create a new secret named ssh-key-secret with keys for each file in folder bar. | Command:
```bash
kubectl create secret generic ssh-key-secret --from-file=path/to/settings
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of t... |
Create a LoadBalancer service named frontend-lb that maps port 8080 on the service to port 8181 on the pods. | Command:
```bash
kubectl create service loadbalancer frontend-lb --tcp=8080:8181
```
What it does:
Create a LoadBalancer service with the specified name.
Syntax:
`kubectl create service loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "defaul... |
Listen on port 8081 locally and forward data to/from port 8000 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8081 8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected a... |
Create a deployment named "web" with the "centos" image and run the command "yum install -y wget" | Command:
```bash
kubectl create deployment web --image=centos -- yum install -y wget
```
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. O... |
Retrieve information about the replica controller "web", the service "proxy-server-rc", and the pod "backend-pod". | Command:
```bash
kubectl get rc/web service/proxy-server-rc pods/backend-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 namespace... |
Forward traffic from port 5432 on all addresses to port 8000 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 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 ... |
Forward local port 8088 to port 9090 in the analytics-pod and listen on localhost. | Command:
```bash
kubectl port-forward pod/analytics-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 will be selected auto... |
Use the emacs editor to edit the 'monitoring-service' service configuration | Command:
```bash
KUBE_EDITOR="emacs" kubectl edit svc/monitoring-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 varia... |
Create a job called "log-processing-job" using the MySQL image and run the command "mysql --version" within the job. | Command:
```bash
kubectl create job log-processing-job --image=mysql -- mysql --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outpu... |
Display the most recent 20 lines of output for the pod named proxy-server-pod | Command:
```bash
kubectl logs --tail=20 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", "short":... |
Update the label 'role' of the pod 'security' to have the value 'frontend' | Command:
```bash
kubectl label pods security role=frontend
```
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":... |
Scale the mysql deployment in the dev-environment-rs to 7 replicas if the current size is already 7. | Command:
```bash
kubectl scale --current-replicas=7 --replicas=7 deployment/dev-environment-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-... |
Retrieve snapshot logs from all containers in pods that are labeled as "environment=production" | Command:
```bash
kubectl logs -l environment=production --all-containers=true
```
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": "-... |
Create a copy of the backend-pod and set all container images to 'ruby' image using the command 'kubectl debug backend-pod --copy-to=debug-image-1 --set-image=*=ruby'. | Command:
```bash
kubectl debug backend-pod --copy-to=debug-image-1 --set-image=*=ruby
```
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 resource... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/api-config deployment/load-balancer-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... |
Expose a replica set named "ubuntu" as a service on port 8081 | Command:
```bash
kubectl expose rs ubuntu --port=8081 --target-port=808100
```
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.... |
Import the specific keys SMTP_SERVER from the global-config ConfigMap into the deployment named authentication-service-deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/global-config 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 variab... |
Listen on port 8081 on localhost and IP 10.19.21.23, and forward traffic to port 8081 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 8081: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 th... |
Create an ingress called 'default-ingress' that directs requests to a specific path to a service, with TLS encryption. | Command:
```bash
kubectl create ingress default-ingress --rule="website.com/bar=svc1:8081,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 a copy of the pod "mypod" and change all container images to "postgres" | Command:
```bash
kubectl debug mypod --copy-to=debug-image-1 --set-image=*=postgres
```
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 resource i... |
Create a secret named ssh-key-secret by importing values from an environment file. | Command:
```bash
kubectl create secret generic ssh-key-secret --from-env-file=path/to/options.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 basena... |
Start a pod named "hazelcast" using the nginx image and expose port 9090 | Command:
```bash
kubectl run hazelcast --image=nginx --port=9090
```
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": "--fi... |
Configure autoscaling for the "proxy-server" deployment with a minimum of 3 pods and a maximum of 15 pods. | Command:
```bash
kubectl autoscale deployment proxy-server --min=3 --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... |
Create a new secret named password-secret by providing a file and a literal value | Command:
```bash
kubectl create secret generic password-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret
```
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... |
Create a cluster role named "foo" with the ability to patch configmaps, and access the resource names backup-service and image-processor. | Command:
```bash
kubectl create clusterrole foo --verb=patch --resource=configmaps --resource-name=backup-service --resource-name=image-processor
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cli... |
Create a cluster role named "reader" with the ability to use the NonResourceURL "/debug/vars" | Command:
```bash
kubectl create clusterrole "reader" --verb=use --non-resource-url=/debug/vars
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "sho... |
Set the client-key-data field for the cloud-user user by providing the certificate data using the `--set-raw-bytes=true` option. | Command:
```bash
kubectl config set users.cloud-user.client-key-data cert_data_here --set-raw-bytes=true
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALU... |
Get the output from running the 'geth' command in the first container of the first pod of the loadbalancer-service service. | Command:
```bash
kubectl exec svc/loadbalancer-service -- geth
```
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... |
Forward port 8088 to the pod's port 8080 on localhost and IP address 10.19.21.23 | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/frontend-pod 8088:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criter... |
Create a pod named 'hazelcast' using the 'mcr.microsoft.com/dotnet/core/runtime' image and expose port 8888. | Command:
```bash
kubectl run hazelcast --image=mcr.microsoft.com/dotnet/core/runtime --port=8888
```
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...... |
Forward traffic from port 8088 on localhost and IP address 10.19.21.23 to port 3000 in the pod named api-service-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-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 cri... |
Create a new secret named payment-gateway-secret using the configurations from the path/to/configurations.env file | Command:
```bash
kubectl create secret generic payment-gateway-secret --from-env-file=path/to/configurations.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 defaul... |
Autoscale the deployment "gateway" with a minimum of 2 pods and a maximum of 10 pods. | Command:
```bash
kubectl autoscale deployment gateway --min=2 --max=10
```
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... |
Import the api_key key from the env-vars config map and set it as an environment variable in the monitoring-stack-deployment deployment. | Command:
```bash
kubectl set env --keys=api_key --from=configmap/env-vars 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 definitions ... |
Forward port 5000 on localhost and IP 10.19.21.23 to port 9090 in the log-aggregator-pod pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 5000:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the ... |
Get the output from running the 'mongod' command in the first container of the first pod of the mydeployment deployment. | Command:
```bash
kubectl exec deploy/mydeployment -- mongod
```
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 kubect... |
Update the 'notification-handler-deployment' deployment with the new environment variable DB_HOST=localhost | Command:
```bash
kubectl set env deployment/notification-handler-deployment DB_HOST=localhost
```
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 ... |
Set the cluster setting for a specific context | Command:
```bash
kubectl config set contexts.team-alpha-context.cluster kube-cluster-2
```
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... |
Update the pod named 'email' with the annotation 'last-deployment' and set the value to '2023-03-15', overwriting any existing value | Command:
```bash
kubectl annotate --overwrite pods email 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... |
Create a new pod named 'hazelcast' using the image 'docker.elastic.co/elasticsearch/elasticsearch' and have the container expose port 8089. | Command:
```bash
kubectl run hazelcast --image=docker.elastic.co/elasticsearch/elasticsearch --port=8089
```
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] ... |
Delete the app-cluster cluster from your kubectl configuration. | Command:
```bash
kubectl config delete-cluster app-cluster
```
What it does:
Delete the specified cluster from the kubeconfig.
Syntax:
`kubectl config delete-cluster NAME` |
Forward port 5000 on localhost and IP address 10.19.21.23 to port 9090 within the web-app-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-pod 5000:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Create a debug container by making a copy of the vpn-service-pod and changing all container images to centos | Command:
```bash
kubectl debug vpn-service-pod --copy-to=debug-image-api --set-image=*=centos
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no ... |
Create a copy of the vpn-service-pod with a debug container, changing container images for cache and api. | Command:
```bash
kubectl debug vpn-service-pod -it --copy-to=dgb-img --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 name. Pod... |
Import the redis_host key from the app-config config map into the log-aggregator-deployment deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-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 definitio... |
Retrieve the output from running the 'sleep 3600' command inside the time-machine container of the web-app-pod pod. | Command:
```bash
kubectl exec web-app-pod -c time-machine -- sleep 3600
```
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, us... |
delete pods and services with the names "proxy" and "monitoring" | Command:
```bash
kubectl delete pod,service proxy monitoring
```
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... |
List all deployments in YAML output format, in the "v1.0.0" version of the "custom-apps" API group | Command:
```bash
kubectl get deployments.v1.0.0.custom-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... |
Create a pod disruption budget named statefulset-pdb that will select all pods with the project=my-project label and require a minimum of 9 of them being available at any point in time | Command:
```bash
kubectl create poddisruptionbudget statefulset-pdb --selector=project=my-project --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-availab... |
Forward communication from port 3000 on your localhost and IP 10.19.21.23 to port 5000 on the cdn-service-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 3000:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cri... |
Set environment variables from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/aws-credentials-secret deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one ... |
import the SECRET_KEY key from the global-config config map into the environment of the frontend-deployment deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/global-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 ... |
Get the output from the quantum-quark container in the backend-pod pod | Command:
```bash
kubectl attach backend-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 omitted, us... |
Set the custom TLS server name to "web-cluster" for the cluster entry "prod-cluster" in the kubectl configuration file. | Command:
```bash
kubectl config set-cluster prod-cluster --tls-server-name=web-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-... |
Import specific keys from a config map to the environment variables of a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-name-config deployment/load-balancer-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... |
Update the annotation of the pod with the given key-value pair, overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods media-stream custom-label='my-custom-value'
```
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 l... |
Create a new ClusterIP service named analytics-service-clusterip with a mapping from port 8081 to port 9092 | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=8081:9092
```
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": "-... |
Get the information for replication controller "web", service "proxy-service-rc", and pod "gateway-pod" | Command:
```bash
kubectl get rc/web service/proxy-service-rc pods/gateway-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 namespac... |
Forward local port 5432 to the target port of the "https" service port in a selected pod by the "monitoring-service" service. | Command:
```bash
kubectl port-forward service/monitoring-service 5432: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 sel... |
Forward the local port 5000 to port 8888 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward pod/e-commerce-pod 5000:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected aut... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/api-config deployment/load-balancer-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... |
Copy a file named "foo" from a remote pod to your local machine and save it as "bar" in the /tmp directory. | Command:
```bash
kubectl cp velero/image-resizer-pod-20::/tmp/foo /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 kubec... |
Get the output from running the 'ash' command on the first pod of the 'scheduler-app-deployment' deployment. | Command:
```bash
kubectl exec deploy/scheduler-app-deployment -- ash
```
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... |
Edit the last-applied-configuration annotations for a deployment named 'php' in YAML format. | Command:
```bash
kubectl apply edit-last-applied deployment/php
```
What it does:
Edit the latest last-applied-configuration annotations of resources from the default editor.
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor ... |
Get the output from running the 'elasticsearch-plugin --list' command in the rocket-ranger container of the email-service-pod pod. | Command:
```bash
kubectl exec email-service-pod -c rocket-ranger -- elasticsearch-plugin --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": "Contai... |
Remove all the taints with key 'disktype' from node 'storage-node-13' | Command:
```bash
kubectl taint nodes storage-node-13 disktype-
```
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|y... |
Copy the local file /tmp/foo_dir to the remote pod metrics-exporter-pod-10 in the istio-system namespace, and save it as /tmp/bar_dir. | Command:
```bash
kubectl cp /tmp/foo_dir istio-system/metrics-exporter-pod-10:/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 omitte... |
Create a secret named gcp-service-account-secret using the files in the path/to/configs folder | Command:
```bash
kubectl create secret generic gcp-service-account-secret --from-file=path/to/configs
```
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... |
Copy the ~/.config/kube file from the remote pod "rook-ceph/worker-pod-4" to the local directory /tmp/bar. | Command:
```bash
kubectl cp rook-ceph/worker-pod-4:~/.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 kubec... |
Embed the certificate authority data for the "star-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/cluster-alpha/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... |
Unset the namespace in the app-2-context context. | Command:
```bash
kubectl config unset contexts.app-2-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` |
Forward traffic from port 8088 on localhost and IP address 10.19.21.23 to port 8081 in the pod named api-service-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 8088: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 cri... |
Get detailed information about the backend pod. | Command:
```bash
kubectl describe pods/backend
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that type, provide a name... |
Create a new secret named 'aws-credentials-secret' and use each file in the 'bar' folder as a key, with the file contents as the values | Command:
```bash
kubectl create secret generic aws-credentials-secret --from-file=path/to/data
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename ... |
Add a description 'my frontend running nginx' to the 'log-aggregator' pod only if the resource version is 1. | Command:
```bash
kubectl annotate pods log-aggregator description='my frontend running nginx' --resource-version=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 ... |
Copy the ~/.config/kube file from the web-app-pod-1 pod in the kube-flannel namespace to the /tmp/bar directory on your local machine. | Command:
```bash
kubectl cp kube-flannel/web-app-pod-1:~/.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 k... |
Create an ingress called 'private-service-ingress' that directs requests from foo.com/example to svc1:7000 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="foo.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": "... |
Configure autoscaling for the replication controller "cdn" with a target CPU utilization of 20%, allowing the number of pods to scale between 1 and 6. | Command:
```bash
kubectl autoscale rc cdn --max=6 --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 uses the... |
Forward traffic from port 9090 on your local machine to port 8000 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 9090: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 au... |
Create an ingress called 'private-service-ingress' that directs requests to website.com/example to svc1:3000 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="website.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... |
Create a new namespace named staging | Command:
```bash
kubectl create namespace staging
```
What it does:
Create a namespace with the specified name.
Syntax:
`kubectl create namespace NAME [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go-template|go-templa... |
Embed the client certificate data from the file "~/.kube/admin.crt" into the "operator" entry in the kubectl configuration. | Command:
```bash
kubectl config set-credentials operator --client-certificate=~/.kube/admin.crt --embed-certs=true
```
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-... |
Create a NodePort service named backend-nodeport that forwards traffic from port 3000 on the cluster to port 8000 on the backend service. | Command:
```bash
kubectl create service nodeport backend-nodeport --tcp=3000: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": "",... |
Attach to the time-machine container in the media-stream-pod pod and get the output. | Command:
```bash
kubectl attach media-stream-pod -c time-machine
```
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... |
Add a 'hardware' taint on nodes that have the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app hardware=node-2:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output ... |
Add a taint on nodes with a specific label | Command:
```bash
kubectl taint node -l stack=tech-stack workload=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": "", "us... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.