prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create a service for the replication controller specified in "python-controller.yaml" file | Command:
```bash
kubectl expose -f python-controller.yaml --port=9090 --target-port=8000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the s... |
Create a pod disruption budget named load-balancer-pdb that selects all frontend pods and requires at least four of them to be available at all times. | Command:
```bash
kubectl create poddisruptionbudget load-balancer-pdb --selector=tier=frontend --min-available=4
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=... |
Create a copy of the 'chat-app-pod' pod, adding a debug container and changing the container images | Command:
```bash
kubectl debug chat-app-pod -it --copy-to=dgb-img --image=debian --set-image=logger=logging-app:debug,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource ... |
Embed the certificate authority data for the "on-prem-cluster" cluster entry | Command:
```bash
kubectl config set-cluster on-prem-cluster --embed-certs --certificate-authority=~/.kube/star-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config ... |
Scale the deployment named api-service-rs to have 3 replicas | Command:
```bash
kubectl scale --current-replicas=1 --replicas=3 deployment/api-service-rs
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-vers... |
Listen on port 6379 on all addresses and forward the traffic to port 8080 in the pod named 'backend-pod'. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 6379:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Create an ingress named 'www-ingress' that routes requests from website.com/input to svc1:8000 with TLS certificate 'my-cert' | Command:
```bash
kubectl create ingress www-ingress --rule="website.com/input=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": "", "usage"... |
Create a copy of the mypod pod with a debug container and changing the container images of mailer to mailer:latest and logger to logging-app:debug | Command:
```bash
kubectl debug mypod -it --copy-to=dgb-img --image=debian --set-image=mailer=mailer:latest,logger=logging-app:debug
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and nam... |
Update the node 'gpu-node-12' by adding a taint with the key 'cpu-type', value 'x86', and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes gpu-node-12 cpu-type=x86:NoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One ... |
Forward local port 3000 to port 8080 in a pod selected by the 'monitoring-stack-deployment' deployment. | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 3000 8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
Create a new NodePort service named backend-nodeport that maps port 5000 on the host to port 3306 on the backend | Command:
```bash
kubectl create service nodeport backend-nodeport --tcp=5000:3306
```
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": "",... |
Create a deployment named gateway using the ubuntu image | Command:
```bash
kubectl create deployment gateway --image=ubuntu
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|na... |
Forward port 9090 from the pod to localhost and IP 10.19.21.23 | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-pod 9090: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... |
Listen on your local machine's port 9090 and forward it to port 8088 in the frontend-pod pod | Command:
```bash
kubectl port-forward pod/frontend-pod 9090:8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected autom... |
Forward traffic from port 8080 on localhost and IP address 10.19.21.23 to port 8081 in the 'security-service-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 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 th... |
Create an ingress with multiple hosts and the pathType set to Prefix | Command:
```bash
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:7000" \
--rule="input.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", "... |
Return the snapshot logs from the container 'analytics-pod-1' of the 'search-engine-deployment' deployment | Command:
```bash
kubectl logs deployment/search-engine-deployment -c analytics-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"fl... |
Create an ingress named 'app1-ingress' that routes requests to website.com/input to the service 'svc1' on port 3001 | Command:
```bash
kubectl create ingress app1-ingress --rule="website.com/input=svc1:3001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage... |
Import the 'api_key' key from the 'kube-system-config' config map into the 'user-management-deployment' deployment. | Command:
```bash
kubectl set env --keys=api_key --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 def... |
Describe a resource specified in a YAML file | Command:
```bash
kubectl describe -f params.json
```
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 na... |
Create a new config map named monitoring-config using the specified keys and files | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/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... |
Create a new ClusterIP service named "catalog-service-clusterip" with TCP port mapping from 8083 to 8088. | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=8083:8088
```
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"... |
Import the REDIS_HOST key from the config map named "kube-system-config" into the deployment named "payment-processor-deployment" | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/kube-system-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 variabl... |
Add a taint with the key 'app' and value 'worker-node-3:PreferNoSchedule' on nodes having the label 'service=auth'. | Command:
```bash
kubectl taint node -l service=auth app=worker-node-3:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Outp... |
Create a deployment named "nats" using the "node" image | Command:
```bash
kubectl create deployment nats --image=node
```
What it does:
Create a deployment with the specified name.
Syntax:
`kubectl create deployment NAME --image=image -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|name|go... |
Update the node 'backup-node-14' by adding a taint with key 'cpu-type' and value 'x86' and effect 'NoSchedule' | Command:
```bash
kubectl taint nodes backup-node-14 cpu-type=x86: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. O... |
Create a new secret named monitoring-credentials-secret in the default namespace | Command:
```bash
kubectl create secret generic monitoring-credentials-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 s... |
Open a raw terminal to interact with the cosmic-container in the security-service-pod. | Command:
```bash
kubectl attach security-service-pod -c cosmic-container -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container na... |
Set a custom TLS server name for the cluster-gamma entry in the kubeconfig file. | Command:
```bash
kubectl config set-cluster cluster-gamma --tls-server-name=data-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificat... |
Create a new secret named private-key-secret using the files in the path/to/configurations folder | Command:
```bash
kubectl create secret generic private-key-secret --from-file=path/to/configurations
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the bas... |
Create a copy of the "mypod" pod and add a debug container, while changing container images. | Command:
```bash
kubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=proxy=nginx:1.21,proxy=nginx:1.21
```
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 ... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=log_level --from=configmap/api-config deployment/frontend-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in o... |
Partially update a node by applying a strategic merge patch in JSON format | Command:
```bash
kubectl patch node dev-node-4 -p '{"spec":{"containers":[{"name":"container-name", "resources":{"limits":{"cpu":"200m"}}}]}'
```
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 F... |
Set the cluster field in the prod-context context to edge-cluster. | Command:
```bash
kubectl config set contexts.prod-context.cluster edge-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you wan... |
Forward traffic from port 8888 on your local machine and IP 10.19.21.23 to port 8888 in the pod named "chat-app-pod". | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/chat-app-pod 8888:8888
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criter... |
Create a new secret named 'docker-registry-secret' from the environment variables defined in the 'path/to/parameters.env' file | Command:
```bash
kubectl create secret generic docker-registry-secret --from-env-file=path/to/parameters.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... |
Delete the pods and services with the names "backend" and "auth" | Command:
```bash
kubectl delete pod,service backend auth
```
What it does:
Delete resources by file names, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of argument may be specified: file names, resources and names, or resources and label selector.
So... |
Create a deployment named nats running the centos image and exposing port 8084 | Command:
```bash
kubectl create deployment nats --image=centos --port=8084
```
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 an ingress that directs requests from testing.com/example to svc1:9092 with a tls secret named "my-cert" | Command:
```bash
kubectl create ingress public-service-ingress --rule="testing.com/example=svc1:9092,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"... |
Forward local traffic on port 8081 to port 3000 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward pod/analytics-pod 8081:3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
List the deployments in YAML output format for the "internal-apps" API group with a version of "dev-2.2.0" | Command:
```bash
kubectl get deployments.dev-2.2.0.internal-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 yo... |
Create a cluster role named "view" with the "list", "create", and "connect" verbs on the "pods" resource, and its "status" subresource. | Command:
```bash
kubectl create clusterrole view --verb=list,create,connect --resource=pods,pods/status
```
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": "--outp... |
Taint nodes with label 'team=devops' using taint key 'zone' and value 'backup-node-14' with the effect of 'PreferNoSchedule' | Command:
```bash
kubectl taint node -l team=devops zone=backup-node-14: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": "Out... |
Create an ingress called 'app2-ingress' that directs requests to a specific path and service, with a tls secret. | Command:
```bash
kubectl create ingress app2-ingress --rule="testing.com/input=svc1:3306,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... |
Retrieve information about the 'web' replication controller, 'chat-app' service, and 'chat-app' pod. | Command:
```bash
kubectl get rc/web service/chat-app-rc pods/chat-app-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced y... |
Forward local port 8888 to port 8088 in the log-aggregator-pod and also forward local port 6000 to port 6000 in the log-aggregator-pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 8888 8088
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Start a Ubuntu pod called "hazelcast" and configure the container to expose port 8888. | Command:
```bash
kubectl run hazelcast --image=ubuntu --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...]`
Helpful flags:
"flag": "--f... |
Get the output from running the 'redis-server' command in the 'cyber-sleuth' container of the 'frontend-pod' pod. | Command:
```bash
kubectl exec frontend-pod -c cyber-sleuth -- redis-server
```
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,... |
Set the cluster field in the app-1-context context to moon-cluster | Command:
```bash
kubectl config set contexts.app-1-context.cluster moon-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 you wa... |
Set up basic authentication credentials for the "app-operator" entry | Command:
```bash
kubectl config set-credentials app-operator --username=admin --password=uXFGweU9l35qcif
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfil... |
Use notepad as the editor to edit the authentication-service service | Command:
```bash
KUBE_EDITOR="notepad" kubectl edit svc/authentication-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... |
Set the custom TLS server name for the my-k8s-cluster cluster entry to "prod-cluster" using the command "kubectl config set-cluster my-k8s-cluster --tls-server-name=prod-cluster" | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=prod-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... |
Import specific keys from a ConfigMap to an environment variable in a deployment | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/ui-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 defini... |
Create a cron job named "data-sync" with a schedule of running every minute and the command "redis-cli" using the Redis image. | Command:
```bash
kubectl create cronjob data-sync --image=redis --schedule="*/1 * * * *" -- redis-cli
```
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": "--output", "short": "-o", "def... |
Forward traffic between local port 8888 and pod port 5432 for the 'authentication-service-deployment' deployment | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 8888 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, ... |
Add or update a taint on a node with key "disktype", value "ssd", and effect "NoSchedule" | Command:
```bash
kubectl taint nodes db-node-7 disktype=ssd: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... |
Add a taint with key 'environment' on nodes having label instance=app-instance-1 with the value 'PreferNoSchedule', specifically on the node with label environment=storage-node-13. | Command:
```bash
kubectl taint node -l instance=app-instance-1 environment=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... |
Import specific keys from a config map into a deployment's environment variables. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-config-dev deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Create a new ClusterIP service called my-cs, which will map port 7000 of the service to port 9091 of the pods | Command:
```bash
kubectl create service clusterip my-cs --tcp=7000: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", "default": "", "us... |
Display the modified YAML file of the "database-deployment" deployment with the environment variable "JWT_SECRET" set to "your-jwt-secret" without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/database-deployment JWT_SECRET=your-jwt-secret -o yaml
```
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... |
Attach to the time-machine container in the monitoring-pod and get its output | Command:
```bash
kubectl attach monitoring-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, ... |
Remove the label 'app' from the pod named 'monitoring' if it exists | Command:
```bash
kubectl label pods monitoring 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 tr... |
Set the custom TLS server name "web-cluster" to use for validation for the kube-cluster-2 cluster entry. | Command:
```bash
kubectl config set-cluster kube-cluster-2 --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] [--certificat... |
Create a cluster role named "default_role" with specified API Group, using the kubectl command. | Command:
```bash
kubectl create clusterrole default_role --verb=proxy,get,update --resource=tokenreviews.authentication.k8s.io
```
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... |
List the deployments in YAML format, specifically in the "legacy-1.0.0" version of the "extensions" API group. | Command:
```bash
kubectl get deployments.legacy-1.0.0.extensions -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced yo... |
Set resource request and limits for containers in mongo deployment | Command:
```bash
kubectl set resources deployment mongo --limits=cpu=200m,memory=512Mi --requests=cpu=50m,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... |
Import specific keys from a config map for a deployment | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/log-config deployment/web-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definition... |
Import the EXTERNAL_API_URL key from the app-config-dev config map and set it as an environment variable in the cache-cluster-deployment deployment. | Command:
```bash
kubectl set env --keys=EXTERNAL_API_URL --from=configmap/app-config-dev deployment/cache-cluster-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable ... |
List the 'cdn-service-pod' pod in JSON format | Command:
```bash
kubectl get -o json pod cdn-service-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you will only see ... |
Create a new pod named "nginx" with the image "docker.elastic.co/elasticsearch/elasticsearch", but customize the pod configuration by providing a partial set of values parsed from a JSON string. | Command:
```bash
kubectl run nginx --image=docker.elastic.co/elasticsearch/elasticsearch --overrides='{ "apiVersion": "v2.0.0", "spec": { ... } }'
```
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] [--overri... |
Create a new config map named app-config-prod with specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-prod --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/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... |
create a job named "certificate-renewal" with the image "ruby" and run the command "gem --version" | Command:
```bash
kubectl create job certificate-renewal --image=ruby -- gem --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": "Output ... |
Forward the traffic from port 6379 on all addresses to port 8888 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 6379: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 ... |
Copy the local file "/tmp/foo" to the remote pod "ingress-controller-pod-8" in the "kube-system" namespace, at the path "/etc/kubernetes". | Command:
```bash
kubectl cp :/tmp/foo kube-system/ingress-controller-pod-8:/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 omitte... |
Create a new ClusterIP service named catalog-service-clusterip | Command:
```bash
kubectl create service clusterip catalog-service-clusterip --tcp=8082:3306
```
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 debug container from the email-service-pod with the container images changed to confluentinc/cp-kafka | Command:
```bash
kubectl debug email-service-pod --copy-to=my-debugger --set-image=*=confluentinc/cp-kafka
```
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 d... |
Create a new config map named `namespace-config` using the environment variables from a file | Command:
```bash
kubectl create configmap namespace-config --from-env-file=path/to/configs.env
```
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 t... |
Enable the OpenID Connect auth provider for the "jane.smith" entry with the client ID set to "foo" and the client secret set to "bar" | Command:
```bash
kubectl config set-credentials jane.smith --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:
--... |
List the container name and image of a specific pod | Command:
```bash
kubectl get pod email-service-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
```
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... |
Update pod 'security' by adding the annotation 'compliance-level' with the value 'PCI-DSS' | Command:
```bash
kubectl annotate pods security compliance-level=PCI-DSS
```
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... |
Open the 'payment-service' service for editing using the 'nano' editor | Command:
```bash
KUBE_EDITOR="nano" kubectl edit svc/payment-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 new config map named app-secrets from the key=value pairs in the specified file | Command:
```bash
kubectl create configmap app-secrets --from-file=path/to/settings
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basename ... |
Create a cluster role named "admin_role" with the ability to perform the "get" action on the "services" resource, specifically on the "app-worker-2" and "backup-service" resources. | Command:
```bash
kubectl create clusterrole admin_role --verb=get --resource=services --resource-name=app-worker-2 --resource-name=backup-service
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cli... |
Update the 'app-node-6' node by merging the specified JSON patch, updating the 'someField' field with the value 'newValue' | Command:
```bash
kubectl patch node app-node-6 -p '{"spec":{"someField":"newValue"}'
```
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]`
Helpf... |
Copy the local file /tmp/foo to the remote pod velero/cache-pod-5 in the namespace, and place it at /tmp/bar | Command:
```bash
kubectl cp /tmp/foo velero/cache-pod-5:/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.kuberne... |
Create a LoadBalancer service named security-service-lb | Command:
```bash
kubectl create service loadbalancer security-service-lb --tcp=3001:3001
```
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",... |
Create a new config map named global-config and populate it with data from specified files | Command:
```bash
kubectl create configmap global-config --from-file=conf=/path/to/preferences/file1.txt --from-file=data=/path/to/properties/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating... |
Create a single ingress called 'myapp-ingress' with the rule that directs requests from foo.com/module to svc1:8083 | Command:
```bash
kubectl create ingress myapp-ingress --rule="foo.com/module=svc1:8083,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Embed certificate authority data for the cluster entry | Command:
```bash
kubectl config set-cluster star-cluster --embed-certs --certificate-authority=~/.kube/app-cluster/kubernetes.ca.crt
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-... |
Create a cron job named "system-health-check" that runs the command "redis-server" using the "redis" image every minute. | Command:
```bash
kubectl create cronjob system-health-check --image=redis --schedule="*/1 * * * *" -- redis-server
```
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": "--output", "short... |
execute the 'docker run -d ubuntu sleep 3600' command within the 'log-aggregator-pod' pod and capture the output | Command:
```bash
kubectl exec log-aggregator-pod -c rocket-ranger -- docker run -d ubuntu 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": "C... |
Create a single ingress called 'rontend-ingress' that directs requests to testing.com/bar to svc1:3306 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress rontend-ingress --rule="testing.com/bar=svc1:3306,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... |
Execute the 'redis-server' command in the 'astro-container' from the pod 'gateway-pod' | Command:
```bash
kubectl exec gateway-pod -c astro-container -- redis-server
```
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... |
Create a new cron job called 'monthly-audit' using the 'ruby' image, with a schedule set to run every minute | Command:
```bash
kubectl create cronjob monthly-audit --image=ruby --schedule="*/1 * * * *" -- gem --version
```
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": "--output", "short": "-o... |
Create a role named "view" with ResourceName specified | Command:
```bash
kubectl create role view --verb=watch --resource=pods --resource-name=backup-service --resource-name=identity-provider
```
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... |
Copy the file /tmp/foo from the pod load-balancer-pod-9 in the kube-server cluster to the local directory /etc/kubernetes | Command:
```bash
kubectl cp kube-server/load-balancer-pod-9:/tmp/foo /etc/kubernetes
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Add a taint with key 'hardware' on nodes having the label 'instance=app-instance-1' | Command:
```bash
kubectl taint node -l instance=app-instance-1 hardware=testing-node-11: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": ... |
Create a cron job named "daily-report" that runs the command "java -jar /usr/share/jenkins/jenkins.war" every minute, using the Jenkins image. | Command:
```bash
kubectl create cronjob daily-report --image=jenkins --schedule="*/1 * * * *" -- java -jar /usr/share/jenkins/jenkins.war
```
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:
"fl... |
Import the 'SECRET_KEY' key from the 'ui-config' config map into the 'scheduler-app-deployment' deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/ui-config deployment/scheduler-app-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions... |
Forward local port 8080 to port 5432 in the pod "security-service-pod". | Command:
```bash
kubectl port-forward pod/security-service-pod 8080 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 select... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.