prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
List the deployments in the "legacy-1.0.0" version of the "backup-apps" API group in YAML output format | Command:
```bash
kubectl get deployments.legacy-1.0.0.backup-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced y... |
Create a role named "admin_role" with specific resource names | Command:
```bash
kubectl create role admin_role --verb=get --resource=pods --resource-name=log-aggregator --resource-name=machine-learning
```
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=ser... |
Get output from the first pod of the 'python' replica set | Command:
```bash
kubectl attach rs/python
```
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.kuber... |
Forward local traffic on ports 3000 and 6000 to a selected pod in the log-aggregator-deployment deployment, forwarding data to/from ports 5432 and 6000. | Command:
```bash
kubectl port-forward deployment/log-aggregator-deployment 3000 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 wi... |
Create a cron job called "email-notifications" that runs the command "dotnet --list-sdks" every minute. | Command:
```bash
kubectl create cronjob email-notifications --image=mcr.microsoft.com/dotnet/core/runtime --schedule="*/1 * * * *" -- dotnet --list-sdks
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Hel... |
Restart a deployment named "namespace-2" | Command:
```bash
kubectl rollout restart deployment/namespace-2
```
What it does:
Restart a resource.
Resource rollout will be restarted.
Syntax:
`kubectl rollout restart RESOURCE`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the reso... |
Forward traffic from local port 5432 to the targetPort of the "https" port on the "logging-service" service. | Command:
```bash
kubectl port-forward service/logging-service 5432:https
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be select... |
Forward traffic from port 8000 on localhost and IP address 10.19.21.23 to port 9090 in the mypod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 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 criteria, a p... |
Retrieve the snapshot logs from container authentication-service-deployment-1 of the proxy-server-pod deployment. | Command:
```bash
kubectl logs deployment/authentication-service-deployment -c proxy-server-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]`
Helpfu... |
Set the cluster field to 'dev-cluster' for the 'my-context' context. | Command:
```bash
kubectl config set contexts.staging-context.cluster dev-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 w... |
Get the output from running the 'dotnet' command in the code-explorer container of the media-stream-pod pod | Command:
```bash
kubectl exec media-stream-pod -c code-explorer -- 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, ... |
List a specific pod using the parameters specified in a YAML file, and display the output in YAML format. | Command:
```bash
kubectl get -f parameters.yaml -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 only see r... |
List deployments in YAML output format for the "hotfix-1.1.2" version of the "third-party-apps" API group | Command:
```bash
kubectl get deployments.hotfix-1.1.2.third-party-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 namespa... |
Forward traffic from port 8081 on all addresses to port 8080 in the "web-app-pod" pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/web-app-pod 8081:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Delete a user from the kubectl configuration | Command:
```bash
kubectl config delete-user john.doe
```
What it does:
Delete the specified user from the kubeconfig.
Syntax:
`kubectl config delete-user NAME` |
Create a new config map named app-config-dev using the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap app-config-dev --from-file=settings=/path/to/parameters/file1.txt --from-file=key2=/path/to/parameters/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When crea... |
Open the 'authentication-service' service in the 'vim' editor for editing | Command:
```bash
KUBE_EDITOR="vim" 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 var... |
Apply the configuration in 'manifest.yaml' that matches the label 'instance=app-instance-1' and delete all other resources that are not in the file and match the label 'app=nginx', using the '--prune' flag. | Command:
```bash
kubectl apply --prune -f manifest.yaml -l instance=app-instance-1
```
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 'a... |
Update the image of the first container in the 'chat-app-pod' pod to 'new image' using a JSON patch. | Command:
```bash
kubectl patch pod chat-app-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
```
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... |
Create a new secret named app-config-secret with keys for each file in the folder bar, using the files located at path/to/configs | Command:
```bash
kubectl create secret generic app-config-secret --from-file=path/to/configs
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of... |
Create a cron job named alerts-cleanup that runs every minute, using the amazonlinux image, and executes the command "echo 'Hello'" inside a bash shell | Command:
```bash
kubectl create cronjob alerts-cleanup --image=amazonlinux --schedule="*/1 * * * *" -- /bin/bash -c "echo 'Hello
```
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": "--o... |
Set a custom TLS server name for the "edge-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster edge-cluster --tls-server-name=dev-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate-... |
Copy the local file /tmp/foo_dir to the remote pod task-processor-pod-17 in the kube-node-lease namespace, and save it as /tmp/bar. | Command:
```bash
kubectl cp /tmp/foo_dir kube-node-lease/task-processor-pod-17:/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, ... |
Create a new config map named ui-config using the settings in the /path/to/configs/file1.txt file and the key2 in the /path/to/properties/file2.txt file. | Command:
```bash
kubectl create configmap ui-config --from-file=settings=/path/to/configs/file1.txt --from-file=key2=/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 a c... |
Create a deployment named "ingress" using the image "confluentinc/cp-kafka" | Command:
```bash
kubectl create deployment ingress --image=confluentinc/cp-kafka
```
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 o... |
Create a new config map named env-vars from specified file paths | Command:
```bash
kubectl create configmap env-vars --from-file=settings=/path/to/profiles/file1.txt --from-file=key2=/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 creating a ... |
Add a taint on nodes that have a specific label | Command:
```bash
kubectl taint node -l namespace=mynamespace dedicated=gpu-node-12: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 port 6379 on all addresses to port 8888 in the backend-pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-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 ... |
Set the cluster field in the context to a specific value | Command:
```bash
kubectl config set contexts.edge-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 wan... |
Listen on port 8081 locally and forward the traffic to port 8088 in the 'backend-pod' pod. | Command:
```bash
kubectl port-forward pod/backend-pod 8081: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 automa... |
Create a deployment named 'monitoring' that uses the 'jenkins' image and exposes port 8181. | Command:
```bash
kubectl create deployment monitoring --image=jenkins --port=8181
```
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 LoadBalancer service named log-aggregator-lb that maps port 8888 to port 9092. | Command:
```bash
kubectl create service loadbalancer log-aggregator-lb --tcp=8888:9092
```
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", "... |
Get the documentation of the "phase" field in the status section of the services resource by executing the command "kubectl explain resource=services.status.phase". | Command:
```bash
kubectl explain resource=services.status.phase
```
What it does:
List the fields for supported resources.
This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive flag to ... |
Forward port 8000 on all addresses to port 3000 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 8000: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 wil... |
Embed the certificate authority data for a cluster entry | Command:
```bash
kubectl config set-cluster cloud-cluster --embed-certs --certificate-authority=~/.kube/e2e/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-cluster... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/mypod :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 automatically. T... |
Open a terminal session to interact with the 'stardust-shuttle' container in the 'mypod' pod, enabling input and output streams. | Command:
```bash
kubectl attach mypod -c stardust-shuttle -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 omitted,... |
Delete the 'sun-cluster' cluster configuration. | Command:
```bash
kubectl config delete-cluster sun-cluster
```
What it does:
Delete the specified cluster from the kubeconfig.
Syntax:
`kubectl config delete-cluster NAME` |
Import specific keys from a config map to a deployment's environment variables | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/ui-config 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 variabl... |
Add a taint with the key 'app' and value 'prod-node-5:PreferNoSchedule' on nodes that have the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app app=prod-node-5: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 ... |
Apply the configuration in the manifest.yaml file, which matches the label owner=john-doe, and delete all other resources that are not in the file and match the label app=nginx. | Command:
```bash
kubectl apply --prune -f manifest.yaml -l owner=john-doe
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or ... |
Forward all traffic from port 8000 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 8000: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 ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=redis_host --from=configmap/db-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... |
Create a service for the 'alpine' deployment that serves on port 8181 and connects to the containers on port 637900 | Command:
```bash
kubectl expose deployment alpine --port=8181 --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 specifi... |
Create an ingress with TLS enabled using the secret "secret1" and pathType set to "Prefix". | Command:
```bash
kubectl create ingress ingsecret --class=default \
--rule="testing.com/*=svc:27017,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":... |
Return the previous terminated logs of the 'code-explorer' container from the 'gateway-pod' pod | Command:
```bash
kubectl logs -p -c code-explorer gateway-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 new ClusterIP service named 'database-service-clusterip' with the port mapping TCP 8080 to 9092 | Command:
```bash
kubectl create service clusterip database-service-clusterip --tcp=8080:9092
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o... |
Set a custom TLS server name for the "dev-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster dev-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] [--certificate-... |
Update the 'frontend-deployment' deployment with a new environment variable called MAX_CONNECTIONS and set its value to 100 | Command:
```bash
kubectl set env deployment/frontend-deployment MAX_CONNECTIONS=100
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates ... |
Set basic authentication credentials for the "k8s-admin" user with the username "admin" and password "uXFGweU9l35qcif" | Command:
```bash
kubectl config set-credentials k8s-admin --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=keyfile
B... |
Begin streaming the logs of the warp-drive container in the media-stream-pod pod. | Command:
```bash
kubectl logs -f -c warp-drive 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", "... |
Set custom TLS server name for cluster-beta | Command:
```bash
kubectl config set-cluster cluster-beta --tls-server-name=cluster-gamma
```
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... |
Get the output of the `elasticsearch-plugin --list` command from the `api-service-pod` pod using the first container. | Command:
```bash
kubectl exec api-service-pod -- elasticsearch-plugin --list
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitte... |
Import the DEBUG_MODE key from a ConfigMap to a deployment named scheduler-app-deployment | Command:
```bash
kubectl set env --keys=DEBUG_MODE --from=configmap/kube-system-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 de... |
Create an ingress called 'api-gateway-ingress' with the following rules: | Command:
```bash
kubectl create ingress api-gateway-ingress --rule="site.com/module=svc1:5000,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": "", "... |
Update the "container-name" container in the node identified by the type and name specified in "cni.conf" file using strategic merge patch | Command:
```bash
kubectl patch -f cni.conf -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 FILEN... |
Create a service for a replicated hazelcast using replica set, which serves on port 8082 and connects to the containers on port 500100 | Command:
```bash
kubectl expose rs hazelcast --port=8082 --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 specified po... |
Listen on port 8088 locally, forwarding data to/from port 3000 in the 'cdn-service-pod' pod | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8088 3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Update the annotation 'custom-label' of pod 'web' to 'my-custom-value' | Command:
```bash
kubectl annotate pods web custom-label=my-custom-value
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include arbit... |
Build the application from a GitHub repository | Command:
```bash
kubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6
```
What it does:
Build a set of KRM resources using a 'kustomization.yaml' file. The DIR argument must be a path to a directory containing 'kustomization.yaml', or a git repository URL with a path suffix... |
Forward port 8088 from localhost and IP 10.19.21.23 to port 8081 in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-pod 8088:8081
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the ... |
Create a new ExternalName service named 'external-database-service' and associate it with the external name 'dummy-website.io' | Command:
```bash
kubectl create service externalname external-database-service --external-name dummy-website.io
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference se... |
Forward port 6379 from the local machine to the pod named "web-app-pod" on port 6379, allowing access from both localhost and IP address 10.19.21.23 | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-pod 6379:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteri... |
Set the cluster field in the dev-context context to moon-cluster. | Command:
```bash
kubectl config set contexts.dev-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 want... |
Forward local port 5432 to port 8080 in the backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 5432: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 automa... |
Import the "MAX_CONNECTIONS" key from the "kube-system-config" config map and set it as an environment variable in the "cache-cluster-deployment" deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/kube-system-config 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 variab... |
Create a secret named "email-credentials-secret" from an environment file | Command:
```bash
kubectl create secret generic email-credentials-secret --from-env-file=path/to/settings.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... |
List the container name and image of a pod named "database-pod" in custom columns | Command:
```bash
kubectl get pod database-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 --se... |
Partially update the "replicas" value of the "testing-node-11" node using a strategic merge patch specified as a JSON. | Command:
```bash
kubectl patch node testing-node-11 -p '{"spec":{"replicas":3}'
```
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 fl... |
Get output from running 'python' command in cosmic-container in vpn-service-pod | Command:
```bash
kubectl exec vpn-service-pod -c cosmic-container -- 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... |
Import specific keys from a config map to an environment variable | Command:
```bash
kubectl set env --keys=max_connections --from=configmap/log-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 defin... |
Partially update the 'edge-node-10' node using a strategic merge patch | Command:
```bash
kubectl patch node edge-node-10 -p '{"spec":{"rules":[{"http":{"paths":[{"path":"/","backend":{"service": {"name": "new-service"}}}]}}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`kubectl ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=config_file_path --from=configmap/ui-config deployment/api-server-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definiti... |
Retrieve snapshot logs from all containers in pods with the label "app=nginx" | Command:
```bash
kubectl logs -l app=nginx --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": "--container", ... |
Mark the node "app-node-6" as unschedulable. | Command:
```bash
kubectl cordon app-node-6
```
What it does:
Mark node as unschedulable.
Syntax:
`kubectl cordon NODE`
Helpful flags:
"flag": "--selector", "short": "-l", "default": "", "usage": "Selector (label query) to filter on " |
Restart the 'namespace-3' deployment. | Command:
```bash
kubectl rollout restart deployment/namespace-3
```
What it does:
Restart a resource.
Resource rollout will be restarted.
Syntax:
`kubectl rollout restart RESOURCE`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files identifying the reso... |
Resume the paused deployment for the app-v2 deployment. | Command:
```bash
kubectl rollout resume deployment/app-v2
```
What it does:
Resume a paused resource.
Paused resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently only deployments support being resumed.
Syntax:
`kubectl rollout resume RESOURCE`
Helpfu... |
Create a service for the replicated centos using a replica set | Command:
```bash
kubectl expose rs centos --port=80 --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. A... |
Copy the ~/.config/kube directory from the backend-pod-13 pod to the /tmp/bar_dir directory on your local machine. | Command:
```bash
kubectl cp logging/backend-pod-13:~/.config/kube /tmp/bar_dir
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the k... |
Execute the command 'apache2ctl -D FOREGROUND' in the first container of the 'mydeployment' deployment and display the output. | Command:
```bash
kubectl exec deploy/mydeployment -- apache2ctl -D FOREGROUND
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitt... |
Get the output from running the 'mongo --version' command from the first container of the web-app-deployment deployment. | Command:
```bash
kubectl exec deploy/web-app-deployment -- mongo --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,... |
Forward local port 9090 to port 8081 on the pod named "backend-pod" | Command:
```bash
kubectl port-forward pod/backend-pod 9090 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 selected automa... |
Forward traffic from port 8000 on all addresses to port 8088 in the e-commerce-pod pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/e-commerce-pod 8000: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 wi... |
Create a copy of the media-stream-pod with a debug container and updated container images | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-api --image=debian --set-image=web=nginx:latest,app=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... |
Update the image of all containers in the daemonset named 'nginx' to 'ruby:3.0.2' | Command:
```bash
kubectl set image daemonset nginx *=ruby:3.0.2
```
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:
`kubectl... |
Set the cpu and memory limits for the ubuntu container in the deployment named "ubuntu" | Command:
```bash
kubectl set resources deployment ubuntu -c=nginx --limits=cpu=500m,memory=1Gi
```
What it does:
Specify compute resource requirements (CPU, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to ... |
Set resource limits for the Ubuntu container in the deployment. | Command:
```bash
kubectl set resources deployment ubuntu -c=nginx --limits=cpu=2,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 requested, but may burst up to its... |
Create a new LoadBalancer service named vpn-service-lb that forwards traffic from port 8181 to port 8084. | Command:
```bash
kubectl create service loadbalancer vpn-service-lb --tcp=8181:8084
```
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", "def... |
Create a copy of the "media-stream-pod" with a debug container and change the container images | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-api --image=debian --set-image=cache=redis:alpine,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 resou... |
Forward port 6379 in the 'mypod' pod to port 8080 on your local machine | Command:
```bash
kubectl port-forward pod/mypod 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 will be selected automaticall... |
Create a job with a given image and command | Command:
```bash
kubectl create job certificate-renewal --image=ethereum/client-go -- geth
```
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": "Ou... |
Auto scale the replication controller "gateway" to have a minimum of 1 pod and a maximum of 8 pods, targeting a CPU utilization of 20%. | Command:
```bash
kubectl autoscale rc gateway --max=8 --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... |
Import the 'SECRET_KEY' key from the 'api-config' config map and set it as an environment variable in the 'search-engine-deployment' deployment. | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/api-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 definition... |
Forward local ports 6379 and 6000 to ports 6379 and 6000 respectively in the log-aggregator-pod pod. | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 6379 6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Forward local ports to a pod | Command:
```bash
kubectl port-forward pod/analytics-pod 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 will be selected auto... |
Stream the logs of the "cyber-sleuth" container in the "log-aggregator-pod" pod | Command:
```bash
kubectl logs -f -c cyber-sleuth log-aggregator-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... |
Create a pod disruption budget named replica-set-pdb that will select all pods with the role=worker label and require at least one of them being available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=role=worker --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 [-... |
Execute the 'dotnet' command on the first pod of the 'database-deployment' deployment | Command:
```bash
kubectl exec deploy/database-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, use the... |
Set the resource request and limits for all containers in the elasticsearch deployment | Command:
```bash
kubectl set resources deployment elasticsearch --limits=cpu=200m,memory=512Mi --requests=cpu=2,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 req... |
Forward requests from local port 5000 to port 5432 in the pod "chat-app-pod" | Command:
```bash
kubectl port-forward pod/chat-app-pod 5000: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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.