prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Create an ingress named 'public-api-ingress' with the following rules: | Command:
```bash
kubectl create ingress public-api-ingress --rule="testing.com/example=svc1:8888,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 traffic from port 5000 on localhost and IP 10.19.21.23 to port 8081 in the log-aggregator-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 5000: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 ... |
Set the cpu limits of the ubuntu container in the deployment named "ubuntu" to "100m" and the memory limits to "128Mi". | Command:
```bash
kubectl set resources deployment ubuntu -c=nginx --limits=cpu=100m,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 requested, but may burst up t... |
Check if you have permission to list the "deploy-artifacts-job" job in the "kube-ingress" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/deploy-artifacts-job -n kube-ingress
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a part... |
Forward traffic from port 8080 on localhost and IP 10.19.21.23 to port 8888 in the pod named cdn-service-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 8080: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 cri... |
Create an ingress called 'private-api-ingress' that routes requests from testing.com/input to a service named 'svc1' running on port 9090, with a TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress private-api-ingress --rule="testing.com/input=svc1:9090,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": "",... |
Add a taint with key 'app' on nodes that have the label 'customer=acme-corp' | Command:
```bash
kubectl taint node -l customer=acme-corp app=db-node-7: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": "Ou... |
Retrieve snapshot logs from the container 'cdn-service-pod-1' of the 'order-processing-deployment' deployment. | Command:
```bash
kubectl logs deployment/order-processing-deployment -c cdn-service-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... |
Update the 'someField' field of the 'k8s-node-1' node with the value 'newValue' | Command:
```bash
kubectl patch node k8s-node-1 -p $'spec:\n 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]`
Helpful f... |
Scale a resource to a specific number of replicas based on the configuration provided in the "options.yaml" file. | Command:
```bash
kubectl scale --replicas=3 -f options.yaml
```
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, it is validat... |
Create a config map named "app-settings" and populate it with key-value pairs sourced from specific files. | Command:
```bash
kubectl create configmap app-settings --from-file=properties=/path/to/options/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 creati... |
Set the cpu limits of the nginx container in the deployment called 'nginx' to 1 and memory limits to 256Mi | Command:
```bash
kubectl set resources deployment nginx -c=nginx --limits=cpu=1,memory=256Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to it... |
Import the specific keys "my-example-key" from the "global-config" config map into the environment variables of the "notification-handler-deployment" deployment. | Command:
```bash
kubectl set env --keys=my-example-key --from=configmap/global-config deployment/notification-handler-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment varia... |
Add a taint with the key 'cpu-type' and the value 'kube-master-9:PreferNoSchedule' on all nodes with the label 'role=database' | Command:
```bash
kubectl taint node -l role=database cpu-type=kube-master-9:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Set the cluster field in the 'my-context' context to 'prod-cluster' | Command:
```bash
kubectl config set contexts.dev-context.cluster prod-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 want... |
Forward local port 5432 to the pod selected by the search-engine-deployment deployment, and vice versa. | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 5432 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 wil... |
Forward traffic from port 8081 on all addresses to port 9090 in the pod named "security-service-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/security-service-pod 8081: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 ... |
Create a service for the 'ruby' replica set, which serves on port 5001 and connects to the containers on port 700000. | Command:
```bash
kubectl expose rs ruby --port=5001 --target-port=700000
```
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... |
Start a hazelcast pod with custom specifications parsed from a JSON file | Command:
```bash
kubectl run nginx --image=hazelcast/hazelcast --overrides='{ "apiVersion": "feature-branch-2.3.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] [--overrides=inline-j... |
Import specific keys from a config map into an environment variable for a specific deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-config-dev deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable d... |
Create a port-forward to listen on port 8080 on both localhost and IP 10.19.21.23, and forward the traffic to port 9090 in the pod named log-aggregator-pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8080:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the ... |
Create a new config map named "app-config" | Command:
```bash
kubectl create configmap app-config --from-file=conf=/path/to/configurations/file1.txt --from-file=data=/path/to/profiles/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a... |
Create a deployment with an Alpine image and run the `ash` command. | Command:
```bash
kubectl create deployment api --image=alpine -- ash
```
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... |
Create a new ClusterIP service named my-cs that maps port 8081 on the service to port 8080 on the target | Command:
```bash
kubectl create service clusterip my-cs --tcp=8081:8080
```
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... |
Create a cron job named "system-health-check" that runs the command "jenkins-plugin-cli" every minute. | Command:
```bash
kubectl create cronjob system-health-check --image=jenkins --schedule="*/1 * * * *" -- jenkins-plugin-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"... |
Forward local port to pod | Command:
```bash
kubectl port-forward pod/security-service-pod 8888: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 select... |
Create a service for a replication controller with specified ports | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=8081 --target-port=801000
```
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 ... |
Attach to the pod "mypod" and get output from the "rocket-ranger" container. | Command:
```bash
kubectl attach mypod -c rocket-ranger
```
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 ... |
Forward local port 5432 to port 8000 in a pod selected by the authentication-service-deployment deployment. | Command:
```bash
kubectl port-forward deployment/authentication-service-deployment 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, ... |
List the deployments in the "beta-1.0" version of the "experimental-apps" API group in YAML output format. | Command:
```bash
kubectl get deployments.beta-1.0.experimental-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... |
Scale a resource specified in "conf.json" to 3 replicas | Command:
```bash
kubectl scale --replicas=3 -f conf.json
```
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, it is validated ... |
Remove all taints with the key 'hardware' from the node 'web-node-8' | Command:
```bash
kubectl taint nodes web-node-8 hardware-
```
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|yaml|n... |
Create a role binding for multiple users and groups using a specific cluster role | Command:
```bash
kubectl create rolebinding bar --clusterrole=bar --user=developer3 --user=k8s-admin --group=qa-engineers
```
What it does:
Create a role binding for a particular role or cluster role.
Syntax:
`kubectl create rolebinding NAME --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serv... |
Add a taint to nodes with the label "feature=feature-xyz" and the key "zone=backup-node-14" with the effect "PreferNoSchedule". | Command:
```bash
kubectl taint node -l feature=feature-xyz 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": "", "usag... |
List the replication controller named 'web', the service named 'database-rc', and the pod named 'frontend-pod' | Command:
```bash
kubectl get rc/web service/database-rc pods/frontend-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced y... |
Open a raw terminal connection to the 'nano-bot' container in the 'vpn-service-pod' pod | Command:
```bash
kubectl attach vpn-service-pod -c nano-bot -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Set the server field on the sun-cluster cluster to https://1.2.3.4 | Command:
```bash
kubectl config set clusters.sun-cluster.server https://1.2.3.4
```
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... |
Get the output of the 'dotnet' command running in the 'nebula-navigator' container of the 'mypod' pod | Command:
```bash
kubectl exec mypod -c nebula-navigator -- 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, use the ... |
Create a cluster role named "reader" with the ability to get services resources and specifically access the auth-proxy and cache-redis resource names. | Command:
```bash
kubectl create clusterrole reader --verb=get --resource=services --resource-name=auth-proxy --resource-name=cache-redis
```
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]... |
Taint nodes labeled as 'environment=production' with a taint key 'environment' and value 'testing-node-11:PreferNoSchedule' | Command:
```bash
kubectl taint node -l environment=production environment=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"... |
Forward local port 5432 to port 5000 in the pod named "web-app-pod" | Command:
```bash
kubectl port-forward pod/web-app-pod 5432:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Get deployments in the "beta-1.0" version of the "experimental-apps" API group in JSON format. | Command:
```bash
kubectl get deployments.beta-1.0.experimental-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced... |
Listen on port 6379 on all addresses, and forward the traffic to port 8000 in the 'e-commerce-pod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 6379: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 wi... |
Copy the ~/.config/kube local file to the /etc/kubernetes directory in the web-app-pod-1 pod in the kube-system namespace. | Command:
```bash
kubectl cp ~/.config/kube kube-system/web-app-pod-1:/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... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/api-config deployment/payment-processor-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defi... |
Apply a taint with key 'workload' and value 'dev-node-4:PreferNoSchedule' on nodes having the label 'feature=feature-xyz' | Command:
```bash
kubectl taint node -l feature=feature-xyz workload=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": "", "usag... |
Create a new ExternalName service named 'external-metrics-service' that points to the external name 'governmental-demo.gov' | Command:
```bash
kubectl create service externalname external-metrics-service --external-name governmental-demo.gov
```
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 referenc... |
Retrieve all deployments in the "beta-1.0" version of the "web-apps" API group and display them in YAML format | Command:
```bash
kubectl get deployments.beta-1.0.web-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 will... |
Edit the 'cleanup-job' job in JSON format using the v1 API | Command:
```bash
kubectl edit job.v1.batch/cleanup-job -o json
```
What it does:
Edit a resource from the default editor.
The edit command allows you to directly edit any API resource you can retrieve via the command-line tools. It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or f... |
Create a new ExternalName service named external-payment-gateway-service with the external name demo-service.dev | Command:
```bash
kubectl create service externalname external-payment-gateway-service --external-name demo-service.dev
```
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 refer... |
Create a service for the replicated 'centos' deployment | Command:
```bash
kubectl expose rc centos --port=7000 --target-port=637900
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Update the image of all containers in the daemonset services to 'wordpress:5.8.1' | Command:
```bash
kubectl set image daemonset services *=wordpress:5.8.1
```
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:
... |
List the deployments in the "beta-1.0" version of the "custom-deployments" API group in YAML output format | Command:
```bash
kubectl get deployments.beta-1.0.custom-deployments -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespace... |
Autoscale the deployment "frontend" with a minimum of 5 pods and a maximum of 14 pods | Command:
```bash
kubectl autoscale deployment frontend --min=5 --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 use... |
Create a new NodePort service named 'cdn-service-nodeport' and map the port 3306 of the service to the port 8089 of the pods | Command:
```bash
kubectl create service nodeport cdn-service-nodeport --tcp=3306:8089
```
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":... |
Auto scale the 'analytics' deployment with a minimum of 4 pods and a maximum of 11 pods. | Command:
```bash
kubectl autoscale deployment analytics --min=4 --max=11
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that us... |
Delete pods and services with the names "analytics" and "vpn" | Command:
```bash
kubectl delete pod,service analytics vpn
```
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... |
Import the 'redis_host' key from the 'app-settings' config map and set it as an environment variable in the 'gateway-deployment' deployment. | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/app-settings deployment/gateway-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in... |
Get the output from the nano-bot container in the pod named 'analytics-pod' | Command:
```bash
kubectl attach analytics-pod -c nano-bot
```
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 t... |
Create a new config map named 'app-config-dev' and include the contents of '/path/to/configurations/file1.txt' as the property 'properties' and the contents of '/path/to/settings/file2.txt' as the property 'key1'. | Command:
```bash
kubectl create configmap app-config-dev --from-file=properties=/path/to/configurations/file1.txt --from-file=key1=/path/to/settings/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When ... |
Create a new config map named app-settings from the key=value pairs in the specified file | Command:
```bash
kubectl create configmap app-settings --from-file=path/to/properties
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a config map based on a file, the key will default to the basena... |
Display the most recent 53 lines of logs for the 'backend-pod' pod. | Command:
```bash
kubectl logs --tail=53 backend-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"... |
Create a new secret named docker-registry-secret from an environment file | Command:
```bash
kubectl create secret generic docker-registry-secret --from-env-file=path/to/configs.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 th... |
Forward local traffic from port 8000 to port 8081 in the log-aggregator-deployment pod. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 8000 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 wi... |
Create a new ingress resource called "rontend-ingress" with a rule that directs requests for site.com/bar to the service "svc1" on port 8083 | Command:
```bash
kubectl create ingress rontend-ingress --rule="site.com/bar=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":... |
Rename the context 'cluster-1-context' to 'service-account-context' in your kubeconfig file. | Command:
```bash
kubectl config rename-context cluster-1-context service-account-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 fi... |
Create a pod disruption budget named worker-pdb that will ensure at least one pod with the env=production label is always available. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=env=production --min-available=1
```
What it does:
Create a pod disruption budget with the specified name, selector, and desired minimum available pods.
Syntax:
`kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--d... |
Start a pod named "hazelcast" using the ethereum/client-go image and configure the container to expose port 8081 | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --port=8081
```
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:
... |
Open the order-service service for editing using the nvim editor | Command:
```bash
KUBE_EDITOR="nvim" kubectl edit svc/order-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, ... |
Set the CPU limit of the nginx container in the wordpress deployment to "500m" and the memory limit to "256Mi" | Command:
```bash
kubectl set resources deployment wordpress -c=nginx --limits=cpu=500m,memory=256Mi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst u... |
Update the 'expiration-date' annotation of pod 'email' to '2024-12-31', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods email expiration-date='2024-12-31'
```
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... |
Import environment from a secret for a deployment | Command:
```bash
kubectl set env --from=secret/tls-certificate-secret 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 definitions ... |
create a job with the name 'data-migration-job' and using the 'mysql' image, running the command 'mysql' | Command:
```bash
kubectl create job data-migration-job --image=mysql -- mysql
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. ... |
Attach to the log-aggregator-pod container named rocket-ranger in raw terminal mode | Command:
```bash
kubectl attach log-aggregator-pod -c rocket-ranger -i -t
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. I... |
Update the pod identified in the "options.json" file with the annotation "alert-email" set to "alerts@example.com" | Command:
```bash
kubectl annotate -f options.json alert-email=alerts@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 incl... |
Create a new ClusterIP service named my-cs with a TCP port mapping from 8082 on the service to port 7000 on the pods. | Command:
```bash
kubectl create service clusterip my-cs --tcp=8082:7000
```
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... |
Remove the label 'role' from the pod 'log-aggregator' | Command:
```bash
kubectl label pods log-aggregator role-
```
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": "... |
List deployments in JSON output format from the "beta-1.0" version of the "third-party-apps" API group | Command:
```bash
kubectl get deployments.beta-1.0.third-party-apps -o json
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced ... |
set the CPU and memory limits to 200m and 512Mi respectively, and set the CPU and memory requests to 200m and 4Gi respectively for all containers in the mysql deployment | Command:
```bash
kubectl set resources deployment mysql --limits=cpu=200m,memory=512Mi --requests=cpu=200m,memory=4Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requeste... |
Return the snapshot logs from the 'backend-pod' container of the 'load-balancer-deployment-1' deployment | Command:
```bash
kubectl logs deployment/load-balancer-deployment -c backend-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag... |
Set the service account of the deployment "payment-processor-deployment" to "tiller" | Command:
```bash
kubectl set serviceaccount deployment payment-processor-deployment tiller
```
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:
`k... |
Import specific keys from a config map into the environment variables of a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/global-config deployment/search-engine-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable defin... |
Run the command 'java -jar /usr/share/jenkins/jenkins.war' in the code-explorer container of the api-service-pod pod | Command:
```bash
kubectl exec api-service-pod -c code-explorer -- java -jar /usr/share/jenkins/jenkins.war
```
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": "", "usag... |
Execute the 'go version' command in the quantum-quark container of the backend-pod pod and display the output | Command:
```bash
kubectl exec backend-pod -c quantum-quark -- go version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, u... |
Execute the 'python' command in the 'rocket-ranger' container of the 'proxy-server-pod' pod and display the output | Command:
```bash
kubectl exec proxy-server-pod -c rocket-ranger -- python
```
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, ... |
Create a service for the replication controller specified in "php-controller.yaml" | Command:
```bash
kubectl expose -f php-controller.yaml --port=3000 --target-port=818100
```
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 sp... |
Output the modified deployment in YAML format without making changes to the object on the server | Command:
```bash
kubectl set env deployment/order-processing-deployment DB_PASSWORD=secretpassword -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... |
Copy the directory /tmp/foo_dir from the remote pod named admin-dashboard-pod-16 in the istio-system namespace to the /tmp/bar directory locally. | Command:
```bash
kubectl cp istio-system/admin-dashboard-pod-16:/tmp/foo_dir /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, us... |
Create a new config map called api-config using the properties file located at /path/to/settings/file1.txt and the key1 file located at /path/to/options/file2.txt. | Command:
```bash
kubectl create configmap api-config --from-file=properties=/path/to/settings/file1.txt --from-file=key1=/path/to/options/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 ... |
List deployments in YAML output format using the "alpha-2.0" version of the "legacy-apps" API group. | Command:
```bash
kubectl get deployments.alpha-2.0.legacy-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 ... |
Create a pod disruption budget named worker-pdb that will select all pods with the app=rails label and ensure that at least 9 of them are available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget worker-pdb --selector=app=rails --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-available=N [--dry-ru... |
Display the last 53 lines of logs from the pod named security-service-pod. | Command:
```bash
kubectl logs --tail=53 security-service-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "sho... |
Forward local port 9090 to port 9090 in the pod named "proxy-server-pod" | Command:
```bash
kubectl port-forward pod/proxy-server-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 criteria, a pod will be selected a... |
Set the CPU limit to "1" and memory limit to "2Gi" for the container named "nginx" in the deployment named "go". | Command:
```bash
kubectl set resources deployment go -c=nginx --limits=cpu=1,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 spe... |
Create a service for the replicated centos using a replica set, which serves on port 3001 and connects to the containers on port 9090. | Command:
```bash
kubectl expose rs centos --port=3001 --target-port=909200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified port.... |
Update the pod named 'monitoring' by removing the label named 'bar' | Command:
```bash
kubectl label pods monitoring component-
```
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": ... |
Apply the configuration in the manifest.yaml file to all resources with the label cluster=my-cluster, and delete any other resources that are not in the file and do not have the label app=nginx | Command:
```bash
kubectl apply --prune -f manifest.yaml -l cluster=my-cluster
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply'... |
forward traffic from port 6379 on your local machine to port 5432 in the pod named "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 6379: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 autom... |
create service for php deployment serving on port 80, connecting to containers on port 8000 | Command:
```bash
kubectl expose deployment php --port=8888 --target-port=909100
```
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 ... |
Forward port 8080 of your local machine to port 3000 in the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 8080: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 automaticall... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.