prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Switch to the raw terminal mode and interact with the 'bash' shell in the mycontainer container from the monitoring-pod pod. | Command:
```bash
kubectl attach monitoring-pod -c mycontainer -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 omit... |
Start a pod named 'hazelcast' using the 'ubuntu' image and allow the container to expose port 8080 | Command:
```bash
kubectl run hazelcast --image=ubuntu --port=8080
```
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... |
Create a debugging session for the media-stream pod, with an interactive terminal and copy the pod to a debug image named debug-image-memcached | Command:
```bash
kubectl debug media-stream-pod -it --copy-to=debug-image-memcached --container=lunar-launcher -- sh
```
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... |
Embed the certificate authority data for the 'staging-cluster' cluster entry by running the command 'kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/cluster-gamma/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/cluster-gamma/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... |
Create a pod named nginx with the python image, but customize the specifications using a JSON override. | Command:
```bash
kubectl run nginx --image=python --overrides='{ "apiVersion": "custom-version", "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-json] [--command] --... |
Forward traffic from local port 8080 to port 8000 in the pod named "api-service-pod" | Command:
```bash
kubectl port-forward pod/api-service-pod 8080:8000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected au... |
Forward local port to pod port | Command:
```bash
kubectl port-forward pod/security-service-pod 3000 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 select... |
Get output from time-machine container in the web-app-pod pod | Command:
```bash
kubectl attach web-app-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, use... |
Start a ruby pod with custom spec values | Command:
```bash
kubectl run nginx --image=ruby --overrides='{ "apiVersion": "v1.1.1", "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-json] [--command] -- [COMMAND]... |
Forward data between local port 5000 and pod port 5432 in the 'mydeployment' deployment | Command:
```bash
kubectl port-forward deployment/mydeployment 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 selecte... |
Create a deployment named 'my-dep' using the 'hazelcast/hazelcast' image and expose port 8080. | Command:
```bash
kubectl create deployment my-dep --image=hazelcast/hazelcast --port=8080
```
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 form... |
create an ingress that directs requests to a specific endpoint, with a tls secret | Command:
```bash
kubectl create ingress api-v1-ingress --rule="testing.com/module=svc1:8010,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": "", "us... |
Create a job named "indexing" with the CentOS image, and the command "sleep 3600" | Command:
```bash
kubectl create job indexing --image=centos -- sleep 3600
```
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. One ... |
Create an ingress resource called 'private-service-ingress' that routes requests for 'testing.com/example' to the service 'svc1' on port 9091, and use the TLS secret named 'my-cert' as the certificate for HTTPS traffic. | Command:
```bash
kubectl create ingress private-service-ingress --rule="testing.com/example=svc1:9091,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default... |
Create an ingress named 'api-ingress' with a rule that directs requests made to 'website.com/input' to service 'svc1' on port '8082' | Command:
```bash
kubectl create ingress api-ingress --rule="website.com/input=svc1:8082,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"... |
Remove all taints with key 'disktype' from node 'dev-node-4' | Command:
```bash
kubectl taint nodes dev-node-4 disktype-
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: json|yaml|n... |
Run the command 'yum install -y aws-cli' inside the 'rocket-ranger' container of the 'mypod' pod. | Command:
```bash
kubectl exec mypod -c rocket-ranger -- yum install -y aws-cli
```
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 omit... |
Update the annotation for pod 'frontend' with a new value | Command:
```bash
kubectl annotate --overwrite pods frontend description='Web server for marketing site'
```
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 larg... |
Create a cron job named "cleanup-task" with a schedule of running every minute | Command:
```bash
kubectl create cronjob cleanup-task --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", "shor... |
Forward data between local ports 8080 and 6000 and the corresponding ports in a pod selected by the deployment "monitoring-stack-deployment" | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 8080 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 ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-name-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... |
Copy a file from a remote pod to a local directory | Command:
```bash
kubectl cp velero/worker-pod-4:/tmp/foo /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 kubectl.ku... |
Create a job named backup using the mongo image, and run the mongo command within it. | Command:
```bash
kubectl create job backup --image=mongo -- mongo
```
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. One of: json... |
Attach to the warp-drive container in the analytics-pod and get the output | Command:
```bash
kubectl attach analytics-pod -c warp-drive
```
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... |
Run the 'go' command in quantum-quark from the pod named email-service-pod | Command:
```bash
kubectl exec email-service-pod -c quantum-quark -- go
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use... |
Add the label 'app=myapp' to the 'email' pod. | Command:
```bash
kubectl label pods email app=myapp
```
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... |
Create a cluster role named "view" with the permission to get services with the resource name "nginx-proxy" and "load-balancer" | Command:
```bash
kubectl create clusterrole view --verb=get --resource=services --resource-name=nginx-proxy --resource-name=load-balancer
```
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... |
Create a deployment named logging that runs the php image and exposes port 5001 | Command:
```bash
kubectl create deployment logging --image=php --port=5001
```
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... |
Import the LOG_LEVEL key from the kube-system-config config map and set it as an environment variable for the api-server-deployment deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/kube-system-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 defini... |
Create a cron job named monthly-audit with the image set to golang, the schedule set to "*/1 * * * *", and the command set to "go run hello.go". | Command:
```bash
kubectl create cronjob monthly-audit --image=golang --schedule="*/1 * * * *" -- go run hello.go
```
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":... |
attach to the 'warp-drive' container in the 'auth-service-pod' pod and get the output | Command:
```bash
kubectl attach auth-service-pod -c warp-drive
```
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, ... |
Retrieve the snapshot logs from the media-stream-pod-1 container in the scheduler-app-deployment deployment | Command:
```bash
kubectl logs deployment/scheduler-app-deployment -c media-stream-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:
... |
Import the SMTP_SERVER key from the app-config config map and set it as an environment variable in the search-engine-deployment deployment. | Command:
```bash
kubectl set env --keys=SMTP_SERVER --from=configmap/app-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 definitio... |
Display the modified YAML configuration of a deployment, without making any changes to the deployment on the server. | Command:
```bash
kubectl set env deployment/cache-cluster-deployment CACHE_SIZE=64MB -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 pod t... |
Create an ingress called 'app-gateway-ingress' that directs requests to website.com/module to a service named 'svc1' on port 8181, and use the tls secret 'my-cert' for secure communication. | Command:
```bash
kubectl create ingress app-gateway-ingress --rule="website.com/module=svc1:8181,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": ""... |
Create a pod using the wordpress image, but override some of the specifications by providing a JSON file with the necessary changes. | Command:
```bash
kubectl run nginx --image=wordpress --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] [--overrides=inline-json] [--command] -- [COM... |
Forward port 3000 on your local machine to port 8080 in the pod named "mypod" | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 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 p... |
Configure the replication controller "media-stream" to automatically scale the number of pods between 1 and 7 based on CPU utilization, targeting a utilization of 90%. | Command:
```bash
kubectl autoscale rc media-stream --max=7 --cpu-percent=90
```
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... |
Forward traffic from port 5000 on all addresses to port 8000 in the 'cdn-service-pod' pod, and listen on all host interfaces. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/cdn-service-pod 5000: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 w... |
Remove the taint with key 'hardware' and effect 'NoExecute' from the node 'kube-master-9' | Command:
```bash
kubectl taint nodes kube-master-9 hardware:NoExecute-
```
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... |
Delete resources defined in a directory using the kustomize configuration | Command:
```bash
kubectl delete -k config/
```
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.
Some resources, ... |
Create an ingress rule named 'app1-ingress' that will direct requests to 'site.com/module' to the service 'svc1' on port 8000, and use a TLS secret named 'my-cert'. | Command:
```bash
kubectl create ingress app1-ingress --rule="site.com/module=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":... |
Begin streaming the logs of the "stardust-shuttle" container in the "cdn-service-pod" pod. | Command:
```bash
kubectl logs -f -c stardust-shuttle cdn-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": "--containe... |
Create a new ExternalName service named external-git-service | Command:
```bash
kubectl create service externalname external-git-service --external-name news-demo.news
```
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 services ... |
Add the annotation 'deployment-script' with the value 'https://example.com/deploy.sh' to the pod 'analytics' | Command:
```bash
kubectl annotate pods analytics deployment-script='https://example.com/deploy.sh'
```
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 th... |
Remove the taint with key 'special' and effect 'NoSchedule' from the node 'backup-node-14' if it exists | Command:
```bash
kubectl taint nodes backup-node-14 special: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 o... |
Execute the 'python' command in the quantum-quark container of the database-pod pod and display the output | Command:
```bash
kubectl exec database-pod -c quantum-quark -- 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, use ... |
Set up auto-scaling for the replication controller "monitoring" with a target CPU utilization of 60%, allowing the number of pods to range between 1 and 8. | Command:
```bash
kubectl autoscale rc monitoring --max=8 --cpu-percent=60
```
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 u... |
From the chat-app-pod pod, run the 'dotnet --list-runtimes' command in the rocket-ranger container and get the output. | Command:
```bash
kubectl exec chat-app-pod -c rocket-ranger -- dotnet --list-runtimes
```
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. ... |
Print the supported non-namespaced resources | Command:
```bash
kubectl api-resources --scopespaced=false
```
What it does:
Print the supported API resources on the server.
Syntax:
`kubectl api-resources`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output format. One of: wide|name. " |
Retrieve the snapshot logs from all containers in pods that have the label 'owner=john-doe' | Command:
```bash
kubectl logs -l owner=john-doe --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": "--contain... |
Attach to the nano-bot container in the backend-pod and get its output | Command:
```bash
kubectl attach backend-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 the... |
Update the 'cdn' pod by adding an annotation 'team' with the value 'frontend team' | Command:
```bash
kubectl annotate pods cdn team='frontend team'
```
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 arbitrary str... |
Start port forwarding from local port 8000 to the pod's port 8081, allowing connections from localhost and IP 10.19.21.23 | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/security-service-pod 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 th... |
Create a copy of the 'backend-pod' by adding a 'debug' container and changing the container images | Command:
```bash
kubectl debug backend-pod -it --copy-to=debug-image-api --image=debian --set-image=logger=logging-app:debug,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 ... |
Create a service for a replicated node using replica set, which serves on port 8443 and connects to the containers on port 844300 | Command:
```bash
kubectl expose rs node --port=8443 --target-port=844300
```
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... |
Retrieve information about the specified resources | Command:
```bash
kubectl get rc/web service/backend-rc pods/backend-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you... |
List deployments in the JSON output format for the "beta-1.0" version of the "my-apps" API group. | Command:
```bash
kubectl get deployments.beta-1.0.my-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 you will ... |
Forward port 8088 on all addresses to port 9090 in the pod named "backend-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/backend-pod 8088:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will ... |
Set up auto-scaling for the replication controller "auth" with a target CPU utilization of 40% | Command:
```bash
kubectl autoscale rc auth --max=7 --cpu-percent=40
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses th... |
Set the service account of the deployment "database-deployment" to "spinnaker" | Command:
```bash
kubectl set serviceaccount deployment database-deployment spinnaker
```
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:
`kubectl... |
Create a Redis pod named "hazelcast" using the Redis image, and expose port 8088 within the container. | Command:
```bash
kubectl run hazelcast --image=redis --port=8088
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fi... |
Create a deployment named 'grafana' with the image 'node' and the command 'node' | Command:
```bash
kubectl create deployment grafana --image=node -- 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|y... |
Create a service for the 'alpine' deployment that serves on port 80 and connects to the containers on port 8000 | Command:
```bash
kubectl expose deployment alpine --port=8089 --target-port=300100
```
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... |
Update the pod identified in the "pod.json" file by annotating its security-scan-status as "pass" | Command:
```bash
kubectl annotate -f pod.json security-scan-status=pass
```
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... |
Add a taint to node 'testing-node-11' with key 'datacenter' and value 'dc-1' and effect 'NoExecute' | Command:
```bash
kubectl taint nodes testing-node-11 datacenter=dc-1:NoExecute
```
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... |
Display the CPU and memory metrics for the containers running in the 'backend-pod' pod. | Command:
```bash
kubectl top pod backend-pod --containers
```
What it does:
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
Syntax:
`kubectl top pod [... |
Create a job named "log-collection" using the "mysql" image, and run the "mysqld" command within the job. | Command:
```bash
kubectl create job log-collection --image=mysql -- mysqld
```
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. One... |
Update the security scan status annotation of a pod identified by type and name in "settings.json" | Command:
```bash
kubectl annotate -f settings.json security-scan-status=pass
```
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 ... |
Create a new ExternalName service named "external-messaging-service" pointing to the external name "sandbox-site.co" | Command:
```bash
kubectl create service externalname external-messaging-service --external-name sandbox-site.co
```
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... |
Embed the certificate authority data for the 'edge-cluster' cluster entry | Command:
```bash
kubectl config set-cluster edge-cluster --embed-certs --certificate-authority=~/.kube/moon-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... |
Forward traffic from port 5000 on localhost and IP 10.19.21.23 to port 9090 in the e-commerce-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-pod 5000:9090
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the crit... |
Update the label of the pod 'backend' to have the key 'component' and the value 'web' | Command:
```bash
kubectl label pods backend component=web
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": ... |
create a cron job named "alerts-cleanup" using the "jenkins" image that runs the command "jenkins-plugin-cli" every minute. | Command:
```bash
kubectl create cronjob alerts-cleanup --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", "sh... |
Start a pod with the Ethereum client container and expose port 8080. | Command:
```bash
kubectl run hazelcast --image=ethereum/client-go --port=8080
```
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:
... |
Return the snapshot logs from the container named chat-app-pod-1 of the analytics-platform-deployment deployment. | Command:
```bash
kubectl logs deployment/analytics-platform-deployment -c chat-app-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:... |
Create an ingress named 'private-api-ingress' that routes requests from 'website.com/input' to 'svc1:8080' with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress private-api-ingress --rule="website.com/input=svc1:8080,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "",... |
Create an ingress named 'private-service-ingress' that routes traffic from testing.com/module to svc1:3001 with the TLS secret "my-cert" | Command:
```bash
kubectl create ingress private-service-ingress --rule="testing.com/module=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"... |
Add a taint with the key 'environment' and value 'worker-node-3:PreferNoSchedule' on nodes that have the label 'cluster=my-cluster' | Command:
```bash
kubectl taint node -l cluster=my-cluster environment=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": "", ... |
Create a new config map named "db-config" using an environment file. | Command:
```bash
kubectl create configmap db-config --from-env-file=path/to/settings.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 the bas... |
Listen on local port 6379 and forward to port 5000 in the pod named log-aggregator-pod | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 6379: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... |
Update the pod 'foo' by setting the annotation 'backup-strategy' to 'daily backups' | Command:
```bash
kubectl annotate pods foo backup-strategy='daily backups'
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ar... |
Create an ingress resource called 'app-loadbalancer-ingress' with a rule that directs requests to 'website.com/input' to the 'svc1:3000' service | Command:
```bash
kubectl create ingress app-loadbalancer-ingress --rule="website.com/input=svc1:3000,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default"... |
Create a new config map named namespace-config with the specified keys instead of file basenames on disk | Command:
```bash
kubectl create configmap namespace-config --from-file=properties=/path/to/configurations/file1.txt --from-file=key1=/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.
W... |
Add a taint with key 'special' on nodes having label region=eu-west-2. Apply the taint 'PreferNoSchedule' to node 'dev-node-4'. | Command:
```bash
kubectl taint node -l region=eu-west-2 special=dev-node-4:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": ... |
Copy the /var/run/secrets/kubernetes.io/serviceaccount/ directory from a remote pod named ingress-controller-pod-8 in the kube-node-lease namespace to the /tmp/bar directory on your local machine | Command:
```bash
kubectl cp kube-node-lease/ingress-controller-pod-8:/var/run/secrets/kubernetes.io/serviceaccount/ /tmp/bar
```
What it does:
Copy files and directories to and from containers.
Syntax:
`kubectl cp <file-spec-src> <file-spec-dest>`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "... |
Import environment variable from a secret to a deployment. | Command:
```bash
kubectl set env --from=secret/api-secret-key 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 definitions in one or more ... |
Retrieve a single pod in JSON format. | Command:
```bash
kubectl get -o json pod e-commerce-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 r... |
Create a config map named monitoring-config using specified keys from files | Command:
```bash
kubectl create configmap monitoring-config --from-file=settings=/path/to/data/file1.txt --from-file=key2=/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 creating ... |
Add a taint with key 'cpu-type' on nodes having label project=project-alpha, and set the taint value to 'worker-node-3:PreferNoSchedule' | Command:
```bash
kubectl taint node -l project=project-alpha cpu-type=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": "", ... |
Autoscale the replication controller "analytics", with the number of pods between 1 and 7, targeting CPU utilization at 90%. | Command:
```bash
kubectl autoscale rc analytics --max=7 --cpu-percent=90
```
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... |
Check if you have the necessary permissions to list the job named "certificates-renewal-job" in the "production" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/certificates-renewal-job -n production
```
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 pa... |
Set the cluster field of a context to a specific cluster. | Command:
```bash
kubectl config set contexts.edge-context.cluster my-k8s-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... |
Update the annotation 'env' of the pod named 'proxy-server' with the value 'staging', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods proxy-server env='staging'
```
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... |
Create a new secret named 'api-secret-key' and populate it with keys for each file in the 'path/to/data' folder. | Command:
```bash
kubectl create secret generic api-secret-key --from-file=path/to/data
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key will default to the basename of the f... |
Start a ruby pod named 'hazelcast' with the 'ruby' image and let the container expose port 8088 | Command:
```bash
kubectl run hazelcast --image=ruby --port=8088
```
What it does:
Create and run a particular image in a pod.
Syntax:
`kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--fil... |
Listen on port 8000 locally and forward data to port 5432 in the pod 'web-app-pod' | Command:
```bash
kubectl port-forward pod/web-app-pod 8000 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 automa... |
Apply a taint to a specific node with the key 'hardware', value 'gpu' and effect 'NoExecute' | Command:
```bash
kubectl taint nodes node-1 hardware=gpu:NoExecute
```
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: js... |
Add a taint with the key 'workload' on nodes that have the label 'cluster=my-cluster' | Command:
```bash
kubectl taint node -l cluster=my-cluster workload=node-1:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "... |
Enable autoscaling for the replication controller "auth", with a maximum of 2 pods and target CPU utilization set at 90%. | Command:
```bash
kubectl autoscale rc auth --max=2 --cpu-percent=90
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.