prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Remove the 'PreferNoSchedule' taint from node 'k8s-node-1' if it exists with the key 'zone' | Command:
```bash
kubectl taint nodes k8s-node-1 zone: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 format. One of... |
Create a debug container copy of the database-pod by running the command `kubectl debug database-pod -it --copy-to=debug-image-app --image=debian --set-image=logger=logging-app:debug,database=mysql:5.7` | Command:
```bash
kubectl debug database-pod -it --copy-to=debug-image-app --image=debian --set-image=logger=logging-app:debug,database=mysql:5.7
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by res... |
Expose the replicated alpine deployment as a service, serving on port 80 and forwarding traffic to the container port 900000. | Command:
```bash
kubectl expose rc alpine --port=80 --target-port=900000
```
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. A... |
Update the image of all containers in the daemonset "namespace-1" to "postgres:13.4". | Command:
```bash
kubectl set image daemonset namespace-1 *=postgres:13.4
```
What it does:
Update existing container image(s) of resources.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
Syntax:... |
Create a deployment with a specific image and run a command within the container | Command:
```bash
kubectl create deployment api --image=amazonlinux -- yum install -y aws-cli
```
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 f... |
Retrieve the deployments in YAML output format for the "rc-1.1.0" version of the "custom-apps" API group | Command:
```bash
kubectl get deployments.rc-1.1.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 w... |
Forward local port 5432 to pod port 3000 for the cdn-service-pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 5432 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 au... |
Expose a deployment named "ruby" as a service, listening on port 5432 and forwarding traffic to the containers on port 8888. | Command:
```bash
kubectl expose deployment ruby --port=5432 --target-port=888800
```
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... |
Open and edit the 'gateway-service' service using the vi editor. | Command:
```bash
KUBE_EDITOR="vi" 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 cron job that runs a command at a specified schedule | Command:
```bash
kubectl create cronjob monthly-audit --image=mcr.microsoft.com/dotnet/core/runtime --schedule="*/1 * * * *" -- dotnet
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag"... |
Add label 'tier=frontend' to pod 'web' | Command:
```bash
kubectl label pods web tier=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": "If ... |
Create an ingress called 'public-service-ingress' that directs requests to website.com/example to a service named svc1 listening on port 8443 | Command:
```bash
kubectl create ingress public-service-ingress --rule="website.com/example=svc1:8443,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"... |
Edit the context configuration to set the cluster field of the my-context context to cluster-gamma. | Command:
```bash
kubectl config set contexts.cluster-2-context.cluster cluster-gamma
```
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 y... |
Import the specific keys "config_file_path" from the config map "app-config-dev" into the deployment "analytics-platform-deployment". | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/app-config-dev deployment/analytics-platform-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment vari... |
Embed the client certificate data from the ~/.kube/admin.crt file into the "service-account" entry in the kubectl configuration. | Command:
```bash
kubectl config set-credentials service-account --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 --... |
Create a secret with keys for each file in a given folder | Command:
```bash
kubectl create secret generic monitoring-credentials-secret --from-file=path/to/parameters
```
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 ... |
Create an ingress resource called 'public-api-ingress' that routes requests from foo.com/input to the service 'svc1' on port 8083, using the TLS secret 'my-cert' | Command:
```bash
kubectl create ingress public-api-ingress --rule="foo.com/input=svc1:8083,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Create a job with a specific command to run. | Command:
```bash
kubectl create job log-processing-job --image=mcr.microsoft.com/dotnet/core/runtime -- dotnet
```
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", "defaul... |
Forward port 8088 locally to port 6379 in the pod "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 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 au... |
Update the annotations of the pod 'proxy' with the annotation 'backup-strategy' and the value 'daily-backups', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods proxy backup-strategy='daily-backups'
```
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 ... |
Set the "node" deployment's container resource limits for the "nginx" container to use a maximum of 2 CPU units and 2 gigabytes of memory. | Command:
```bash
kubectl set resources deployment node -c=nginx --limits=cpu=2,memory=2Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its s... |
Add a taint with the key 'special' and the value 'dev-node-4:PreferNoSchedule' on the nodes that have the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app special=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": "Outp... |
Display metrics for all pods in the "external-third-party-api-service" namespace | Command:
```bash
kubectl top pod --namespace=external-third-party-api-service
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax... |
Partially update a node by specifying the changes in a YAML patch | Command:
```bash
kubectl patch node testing-node-11 -p $'spec:\n unschedulable: true'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-file FILE]`
Help... |
Display the most recent 5 lines of logs for the pod named "auth-service-pod" | Command:
```bash
kubectl logs --tail=5 auth-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": "--container", "short": ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/ui-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... |
Add a taint with the key 'hardware' and value 'k8s-node-1:PreferNoSchedule' on nodes labeled with 'zone=us-east-1' | Command:
```bash
kubectl taint node -l zone=us-east-1 hardware=k8s-node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Get the output from the `nebula-navigator` container in the `monitoring-pod` pod. | Command:
```bash
kubectl attach monitoring-pod -c nebula-navigator
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Get the output of the 'mysqld' command running in the 'time-machine' container of the 'security-service-pod' | Command:
```bash
kubectl exec security-service-pod -c time-machine -- mysqld
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Update the label of the pod named 'database' to have the key 'env' and the value 'staging' | Command:
```bash
kubectl label pods database env=staging
```
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 deployment named grafana using the amazonlinux image and expose port 7000 | Command:
```bash
kubectl create deployment grafana --image=amazonlinux --port=7000
```
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... |
Create a role named "bar" with the verb "use" and the resource "pods" with resource names "nginx-proxy" and "image-processor" | Command:
```bash
kubectl create role bar --verb=use --resource=pods --resource-name=nginx-proxy --resource-name=image-processor
```
What it does:
Create a role with single rule.
Syntax:
`kubectl create role NAME --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|... |
Execute the 'node' command in the pod named 'analytics-pod' and get the output | Command:
```bash
kubectl exec analytics-pod -- node
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kubern... |
Attach to the backend-pod to get output from it. | Command:
```bash
kubectl attach backend-pod
```
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, use the kubectl.kub... |
Create a new ExternalName service with the name "external-analytics-service" and set the external name to "education-edu.edu" | Command:
```bash
kubectl create service externalname external-analytics-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 ... |
Set up autoscaling for the "vpn" replication controller | Command:
```bash
kubectl autoscale rc vpn --max=3 --cpu-percent=50
```
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... |
Copy the directory /var/run/secrets/kubernetes.io/serviceaccount/ from the remote pod named 'monitoring-agent-pod-6', located in the 'logging' namespace, to the local directory /tmp/bar. | Command:
```bash
kubectl cp logging/monitoring-agent-pod-6:/var/run/secrets/kubernetes.io/serviceaccount/ :/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": "... |
Create a new config map named 'ui-config' using the 'settings' key from the '/path/to/configurations/file1.txt' file and the 'key2' key from the '/path/to/data/file2.txt' file. | Command:
```bash
kubectl create configmap ui-config --from-file=settings=/path/to/configurations/file1.txt --from-file=key2=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a ... |
Create a new config map named 'env-vars' using the files '/path/to/parameters/file1.txt' and '/path/to/configs/file2.txt' for the keys 'conf' and 'data' respectively. | Command:
```bash
kubectl create configmap env-vars --from-file=conf=/path/to/parameters/file1.txt --from-file=data=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config... |
Retrieve the password for the user "prod-cluster" in the kubeconfig file by running the command: kubectl config view -o jsonpath='{.users[?(@.name == "prod-cluster")].user.password}' | Command:
```bash
kubectl config view -o jsonpath='{.users[?(@.name == "prod-cluster")].user.password}'
```
What it does:
Display merged kubeconfig settings or a specified kubeconfig file.
You can use --output jsonpath={...} to extract specific values using a jsonpath expression.
Syntax:
`kubectl config view`
Helpful... |
Taint nodes with label 'owner=john-doe' by adding a 'hardware' taint and setting it to 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l owner=john-doe 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": "Outp... |
Update the 'analytics' pod with the annotation 'git-repo' and the value 'https://github.com/example/my-app', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods analytics 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 la... |
Create a new config map named app-name-config in the default namespace, based on the folder located at path/to/parameters | Command:
```bash
kubectl create configmap app-name-config --from-file=path/to/parameters
```
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... |
Forward local ports 8080 and 6000 to ports 8081 and 6000 in the pod "security-service-pod" | Command:
```bash
kubectl port-forward pod/security-service-pod 8080 8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Create a deployment named 'prometheus' using the 'postgres' image with 5 replicas. | Command:
```bash
kubectl create deployment prometheus --image=postgres --replicas=5
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. On... |
Create an ingress with multiple hosts and pathType as Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:27017" \
--rule="module.com/admin*=svc2:http"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output",... |
Remove the label named 'app' from the pod with the name 'web' | Command:
```bash
kubectl label pods web app-
```
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 true, che... |
Setup automatic scaling for the replication controller "log-aggregator" with the target CPU utilization at 81%, having a minimum of 1 pod and a maximum of 4 pods. | Command:
```bash
kubectl autoscale rc log-aggregator --max=4 --cpu-percent=81
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler th... |
Update the password in the specified YAML file for a Kubernetes node using a strategic merge patch. | Command:
```bash
kubectl patch -f kubeadm-config.yaml -p '{"stringData":{"password":"new-password"}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl patch (-f FILENAME | TYPE NAME) [-p PATCH|--patch-fi... |
Delete the pods and services with the names "email" and "media-stream" | Command:
```bash
kubectl delete pod,service email media-stream
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label select... |
Scale the replica set named 'backend-service-replicaset' to 3 replicas. | Command:
```bash
kubectl scale --replicas=3 rs/backend-service-replicaset
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified,... |
Forward data between local ports 8088 and 6000 and the pod's port 5432 | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8088 5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Set the service account of the deployment "web-app-deployment" to "elasticsearch" | Command:
```bash
kubectl set serviceaccount deployment web-app-deployment elasticsearch
```
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... |
Import the 'smtp_server' key from the 'kube-system-config' config map and set it as an environment variable in the 'user-management-deployment' deployment. | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/kube-system-config deployment/user-management-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... |
Add a taint to nodes with a specific label | Command:
```bash
kubectl taint node -l namespace=mynamespace workload=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": "", ... |
Forward local port 8080 to port 8088 in the 'database-deployment' pod. | Command:
```bash
kubectl port-forward deployment/database-deployment 8080 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 ... |
Set the custom TLS server name to 'cluster-alpha' for the 'app-cluster' cluster entry. | Command:
```bash
kubectl config set-cluster app-cluster --tls-server-name=cluster-alpha
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate... |
Create a new config map named namespace-config with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap namespace-config --from-file=conf=/path/to/parameters/file1.txt --from-file=data=/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 cr... |
Delete the pods and services with the names "foo" and "media-stream" | Command:
```bash
kubectl delete pod,service foo media-stream
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector... |
Forward the local port 8000 and the IP 10.19.21.23 to the pod's port 9090 for the proxy-server-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/proxy-server-pod 8000: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 cr... |
Import environment variables with a specific prefix from a config map into a deployment | Command:
```bash
kubectl set env --from=configmap/namespace-config --prefix=MYSQL_ deployment/backend-microservice-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable... |
Create a new config map named app-name-config in the current namespace with keys 'conf' and 'data' mapped to the contents of /path/to/preferences/file1.txt and /path/to/configs/file2.txt respectively. | Command:
```bash
kubectl create configmap app-name-config --from-file=conf=/path/to/preferences/file1.txt --from-file=data=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating ... |
Add a taint to the node 'dev-node-4' with the key 'hardware' and no value, and set it to not schedule any pods on that node | Command:
```bash
kubectl taint nodes dev-node-4 hardware: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: j... |
Retrieve the output from running the 'php --version' command in the 'cosmic-container' from the 'proxy-server-pod' pod. | Command:
```bash
kubectl exec proxy-server-pod -c cosmic-container -- 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... |
Forward traffic from port 8080 on all addresses to port 6379 in the 'e-commerce-pod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8080:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod wi... |
Update the contact email annotation for a pod specified in the "settings.json" file. | Command:
```bash
kubectl annotate -f settings.json contact-email=support@example.com
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and ... |
Delete the pods and services with the names "auth" and "chat-app" | Command:
```bash
kubectl delete pod,service auth chat-app
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
S... |
Deny a Certificate Signing Request (CSR) with the name 'csr-ghi789' | Command:
```bash
kubectl certificate deny csr-ghi789
```
What it does:
Deny a certificate signing request.
kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.
Syntax:
`kubectl ce... |
Create a service for a replication controller identified by type and name specified in "alpine-controller.yaml", which serves on port 8443 and connects to the containers on port 888800. | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=8443 --target-port=888800
```
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... |
Auto scale the "email" replication controller with the target CPU utilization set at 20% and the number of pods ranging from 1 to 4. | Command:
```bash
kubectl autoscale rc email --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 uses t... |
Create a new config map named app-settings using the specified files: settings=/path/to/options/file1.txt and key2=/path/to/data/file2.txt | Command:
```bash
kubectl create configmap app-settings --from-file=settings=/path/to/options/file1.txt --from-file=key2=/path/to/data/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a conf... |
Create an ingress named 'ingsecret' in the default class, with a rule that forwards all requests for 'website.com' to service 'svc' on port 8181 | Command:
```bash
kubectl create ingress ingsecret --class=default \
--rule="website.com/*=svc:8181,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": "--output", "short": "-o", "default": ... |
Create a copy of the 'proxy-server-pod' pod and add a debug container | Command:
```bash
kubectl debug proxy-server-pod -it --copy-to=my-debugger --image=debian --set-image=web=nginx:latest,scheduler=my-scheduler:1.0
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by res... |
Show the last 5 lines of logs for the 'analytics-pod' pod | Command:
```bash
kubectl logs --tail=5 analytics-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": "-c... |
Update the label of the pod named 'frontend' to have the key 'env' with the value 'staging' | Command:
```bash
kubectl label pods frontend env=staging
```
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": "... |
Import specific keys from a config map into the environment of a deployment named log-aggregator-deployment | Command:
```bash
kubectl set env --keys=SMTP_SERVER --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 definitio... |
Import the 'redis_host' key from the 'app-name-config' config map and set it as an environment variable for the 'frontend-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-name-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 definition... |
Add a taint with the key 'dedicated' and no value to the node named 'dev-node-4' | Command:
```bash
kubectl taint nodes dev-node-4 dedicated:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: ... |
create a deployment with the image "confluentinc/cp-kafka" and run the command "kafka-topics --list" | Command:
```bash
kubectl create deployment proxy --image=confluentinc/cp-kafka -- kafka-topics --list
```
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": ... |
Create a cron job with a specific schedule and command | Command:
```bash
kubectl create cronjob backup-job --image=docker.elastic.co/elasticsearch/elasticsearch --schedule="*/1 * * * *" -- elasticsearch
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful f... |
Copy a local file to a remote pod in a specified namespace | Command:
```bash
kubectl cp :/tmp/foo logging/web-app-pod-1:/tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kub... |
Create a new config map named "app-name-config" with the specified keys | Command:
```bash
kubectl create configmap app-name-config --from-file=properties=/path/to/configs/file1.txt --from-file=key1=/path/to/preferences/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 cre... |
Create an ingress named 'external-ingress' to route requests from testing.com/example to the service 'svc1' on port 8084 | Command:
```bash
kubectl create ingress external-ingress --rule="testing.com/example=svc1:8084,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": "", ... |
Open the 'logging-service' service for editing using the 'code' editor. | Command:
```bash
KUBE_EDITOR="code" kubectl edit svc/logging-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... |
Retrieve the logs of the previous terminated 'nebula-navigator' container from the 'web-app-pod' pod. | Command:
```bash
kubectl logs -p -c nebula-navigator web-app-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", ... |
Expose the hazelcast deployment as a service on port 8084, connecting to the containers on port 500100. | Command:
```bash
kubectl expose deployment hazelcast --port=8084 --target-port=500100
```
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 spec... |
Update the 'search-engine-deployment' deployment by adding the environment variable S3_BUCKET=my-s3-bucket. | Command:
```bash
kubectl set env deployment/search-engine-deployment S3_BUCKET=my-s3-bucket
```
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 te... |
deny a Certificate Signing Request (CSR) with the name 'csr-controller-6' | Command:
```bash
kubectl certificate deny csr-controller-6
```
What it does:
Deny a certificate signing request.
kubectl certificate deny allows a cluster admin to deny a certificate signing request (CSR). This action tells a certificate signing controller to not to issue a certificate to the requestor.
Syntax:
`kube... |
Begin streaming the logs of the specified container within a pod | Command:
```bash
kubectl logs -f -c nano-bot media-stream-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "sh... |
Create a pod named 'hazelcast' using the image 'docker.elastic.co/elasticsearch/elasticsearch' and expose port 9092 | Command:
```bash
kubectl run hazelcast --image=docker.elastic.co/elasticsearch/elasticsearch --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] ... |
Remove the namespace setting for the 'cluster-1-context' context | Command:
```bash
kubectl config unset contexts.cluster-1-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_N... |
Forward port from local machine to pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 5000: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... |
Stream the logs from all containers in pods with the label "cluster=my-cluster" | Command:
```bash
kubectl logs -f -l cluster=my-cluster --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": "--... |
execute the 'dotnet' command in the first pod of the log-aggregator-deployment and retrieve the output | Command:
```bash
kubectl exec deploy/log-aggregator-deployment -- dotnet
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Begin streaming the logs of the code-explorer container in the vpn-service-pod pod. | Command:
```bash
kubectl logs -f -c code-explorer vpn-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": "--container",... |
update the environment variable 'SMTP_HOST' for the deployment 'authentication-service-deployment'. | Command:
```bash
kubectl set env deployment/authentication-service-deployment SMTP_HOST=smtp.example.com
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one o... |
Create a deployment named web with the hazelcast image and expose port 3306 | Command:
```bash
kubectl create deployment web --image=hazelcast/hazelcast --port=3306
```
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.... |
Create a job named "certificate-renewal" with the image "mongo" and the command "mongod" | Command:
```bash
kubectl create job certificate-renewal --image=mongo -- mongod
```
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... |
Configure the OpenID Connect auth provider for the "app-operator" entry with additional arguments | Command:
```bash
kubectl config set-credentials app-operator --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
```
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:
... |
Forward local port 9090 to port 8080 in the pod "api-service-pod" for data transmission. | Command:
```bash
kubectl port-forward pod/api-service-pod 9090 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 au... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.