prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Copy the `/tmp/foo_dir` directory from the `auth-service-pod-11` pod in the `kube-dns` namespace to the `/tmp/bar` directory locally | Command:
```bash
kubectl cp kube-dns/auth-service-pod-11:/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, use the ... |
Forward traffic from port 8081 on your local machine to port 8000 on the pod named "mypod" | Command:
```bash
kubectl port-forward pod/mypod 8081: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 automaticall... |
Add a taint with the key 'hardware' and the value 'web-node-8:PreferNoSchedule' on nodes having the label feature=feature-xyz | Command:
```bash
kubectl taint node -l feature=feature-xyz hardware=web-node-8: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 API resources sorted by a specific column | Command:
```bash
kubectl api-resources --sort-by=kind
```
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. " |
Embed the certificate authority data for the "cluster-gamma" cluster entry | Command:
```bash
kubectl config set-cluster cluster-gamma --embed-certs --certificate-authority=~/.kube/edge-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 se... |
forward local trafic to ports 8081 and 6000 to the 'search-engine-deployment' pods selected by the deployment, the destination ports inside the pods will be 8088 and 6000 respectively. | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 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 wil... |
Create a new NodePort service named proxy-service-nodeport | Command:
```bash
kubectl create service nodeport proxy-service-nodeport --tcp=8000:5432
```
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... |
import specific keys from a config map | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/global-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 de... |
Check if you have permission to list the "security-scan-job" job in the "cert-manager" namespace | Command:
```bash
kubectl auth can-i list jobs.batch/security-scan-job -n cert-manager
```
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 partial... |
create a job named certificate-renewal with the ruby image and run the command "ruby --version" within the job | Command:
```bash
kubectl create job certificate-renewal --image=ruby -- ruby --version
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output... |
Set up port forwarding to listen on port 8088 locally and forward data to port 8000 in a pod selected by the deployment. | Command:
```bash
kubectl port-forward deployment/analytics-platform-deployment 8088 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 po... |
Retrieve the output from the 'cyber-sleuth' container in the 'chat-app-pod' pod | Command:
```bash
kubectl attach chat-app-pod -c cyber-sleuth
```
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, us... |
Add a taint with the key 'app' on nodes that have the label version=v1.0.0 | Command:
```bash
kubectl taint node -l version=v1.0.0 app=node-2:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output fo... |
Set the resource request and limits for all containers in the hazelcast deployment to ensure proper allocation of CPU and memory resources. | Command:
```bash
kubectl set resources deployment hazelcast --limits=cpu=200m,memory=512Mi --requests=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 requ... |
Set CPU and memory limits for the Redis container in a deployment | Command:
```bash
kubectl set resources deployment redis -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 to... |
Retrieve the snapshot logs from the container 'api-server-deployment-1' of the deployment named 'e-commerce-pod' | Command:
```bash
kubectl logs deployment/api-server-deployment -c e-commerce-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... |
Display metrics for the pods with the label "cluster=my-cluster" | Command:
```bash
kubectl top pod -l cluster=my-cluster
```
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 [NAM... |
Copy the local file `/tmp/foo_dir` to the remote pod `database-pod-2` in the container `front-end-container` and place it in the `/etc/kubernetes` directory. | Command:
```bash
kubectl cp /tmp/foo_dir database-pod-2:/etc/kubernetes -c front-end-container
```
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 om... |
Create a new config map named app-config-dev using specified files and keys | Command:
```bash
kubectl create configmap app-config-dev --from-file=properties=/path/to/parameters/file1.txt --from-file=key1=/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 cr... |
Retrieve the output from running the command 'kafka-topics --list' in the astro-container from the pod named 'mypod' | Command:
```bash
kubectl exec mypod -c astro-container -- kafka-topics --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 omitt... |
Execute the 'python --version' command on the first pod of the deployment 'authentication-service-deployment' and get the output. | Command:
```bash
kubectl exec deploy/authentication-service-deployment -- python --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 n... |
Set the CPU limit of the mongo container in the 'mongo' deployment to "500m" and the memory limit to "2Gi" | Command:
```bash
kubectl set resources deployment mongo -c=nginx --limits=cpu=500m,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 i... |
Attach to the 'chat-app-pod' pod and get the output from the 'quantum-quark' container | Command:
```bash
kubectl attach chat-app-pod -c quantum-quark
```
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, u... |
Scale the replica set named 'dev-environment-rs' to a desired number of replicas | Command:
```bash
kubectl scale --replicas=5 rs/dev-environment-rs
```
What it does:
Set a new size for a deployment, replica set, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is v... |
Import environment variables from a secret to a deployment | Command:
```bash
kubectl set env --from=secret/jwt-secret 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 definitions in one or more pod tem... |
Create a pod disruption budget named load-balancer-pdb that will select all pods with the app=nginx label and require at least 20% of the pods selected to be available at any point in time. | Command:
```bash
kubectl create pdb load-balancer-pdb --selector=app=nginx --min-available=20%
```
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-run=serve... |
Create a role binding named 'view' with the 'view' cluster role, and grant access to the users 'developer3' and 'k8s-admin', as well as the group 'qa-engineers'. | Command:
```bash
kubectl create rolebinding view --clusterrole=view --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] [--se... |
Set the service account of the deployment named "authentication-service-deployment" to "cert-manager" | Command:
```bash
kubectl set serviceaccount deployment authentication-service-deployment cert-manager
```
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
... |
Import specific keys from a config map into an environment variable of a deployment | Command:
```bash
kubectl set env --keys=database_url --from=configmap/kube-system-config deployment/proxy-service-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 ... |
Get output from running the 'bash' command in the 'warp-drive' container within the 'auth-service-pod' pod | Command:
```bash
kubectl exec auth-service-pod -c warp-drive -- bash
```
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 t... |
Update the pod named 'proxy' with the label 'env' set to 'production' | Command:
```bash
kubectl label pods proxy env=production
```
What it does:
Update the labels on a resource.
Syntax:
`kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]`
Helpful flags:
"flag": "--all-namespaces", "short": "-A", "default": "false", "usage": "... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=DATABASE_URL --from=configmap/app-config-prod 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... |
Copy the local file /tmp/foo to the /etc/kubernetes directory in the worker-pod-4 pod, specifically in the backend-container container. | Command:
```bash
kubectl cp /tmp/foo worker-pod-4:/etc/kubernetes -c backend-container
```
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, u... |
Return snapshot logs from the container 'web-app-pod-1' of the deployment named 'order-processing-deployment' | Command:
```bash
kubectl logs deployment/order-processing-deployment -c web-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:
"f... |
Delete the pods and services with the names "api" and "backend". | Command:
```bash
kubectl delete pod,service api backend
```
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.
Som... |
Execute the 'go' command in the pod named backend-pod, and use the container named nebula-navigator to run it. | Command:
```bash
kubectl exec backend-pod -c nebula-navigator -- 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 th... |
Import specific keys from a config map to a deployment | Command:
```bash
kubectl set env --keys=log_level --from=configmap/app-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 variable definitions... |
List the deployments in the "dev-2.2.0" version of the "mobile-apps" API group in JSON output format. | Command:
```bash
kubectl get deployments.dev-2.2.0.mobile-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 ... |
Create a cluster role named "view" with API Group specified | Command:
```bash
kubectl create clusterrole view --verb=list,create,update --resource=storageclasses.storage.k8s.io
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]`
Helpful flags:
"fl... |
List deployments in YAML output format using the "v2.0.0" version of the "external-apps" API group. | Command:
```bash
kubectl get deployments.v2.0.0.external-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced you w... |
Create a copy of a pod with a debug container, changing container images | Command:
```bash
kubectl debug mypod -it --copy-to=dgb-img --image=debian --set-image=mailer=mailer:latest,cache=redis:alpine
```
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. Pod... |
Describe pods with a specific label | Command:
```bash
kubectl describe po -l instance=app-instance-1
```
What it does:
Show details of a specific resource or group of resources.
Print a detailed description of the selected resources, including related resources such as events or controllers. You may select a single object by name, all objects of that typ... |
Set the service account of the "email-server-deployment" deployment to "flux" | Command:
```bash
kubectl set serviceaccount deployment email-server-deployment flux
```
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 debug copy of the "monitoring-pod" with additional containers and updated container images | Command:
```bash
kubectl debug monitoring-pod -it --copy-to=debug-image-1 --image=debian --set-image=mailer=mailer:latest,mailer=mailer:latest
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resou... |
Delete the pods and services with the names "proxy-server" and "monitoring" | Command:
```bash
kubectl delete pod,service proxy-server monitoring
```
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 s... |
Create a Pod Disruption Budget that ensures at least 9 pods with the label "env=production" are always available. | Command:
```bash
kubectl create poddisruptionbudget replica-set-pdb --selector=env=production --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... |
Dump the current state of the cluster and save it to the specified directory. | Command:
```bash
kubectl cluster-info dump --output-directory=/tmp/foo_dir
```
What it does:
Dump cluster information out suitable for debugging and diagnosing cluster problems. By default, dumps everything to stdout. You can optionally specify a directory with --output-directory. If you specify a directory, Kuberne... |
Forward local traffic on port 6379 to port 8000 in a pod selected by the web-app-deployment deployment. | Command:
```bash
kubectl port-forward deployment/web-app-deployment 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 will be s... |
Import the specific keys, MAX_CONNECTIONS, from the config map ui-config and set them as environment variables for the cache-cluster deployment. | Command:
```bash
kubectl set env --keys=MAX_CONNECTIONS --from=configmap/ui-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 variable defini... |
Execute the 'apache2ctl -D FOREGROUND' command inside the 'cyber-sleuth' container in the 'email-service-pod' pod and retrieve the output. | Command:
```bash
kubectl exec email-service-pod -c cyber-sleuth -- 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 ... |
Create a job named "cleanup" using the CentOS image and execute the command "yum install -y wget". | Command:
```bash
kubectl create job cleanup --image=centos -- yum install -y wget
```
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 form... |
Set the cluster field to 'staging-cluster' in the 'my-context' context | Command:
```bash
kubectl config set contexts.admin-context.cluster staging-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... |
Forward local port 8000 to the targetPort of the "https" port in a pod selected by the "database-service" service | Command:
```bash
kubectl port-forward service/database-service 8000: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 selec... |
Update node 'node-1' with a taint that specifies the key as 'datacenter', value as 'dc-1', and effect as 'NoExecute' | Command:
```bash
kubectl taint nodes node-1 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. One of:... |
Get the output from running the 'python' command in the 'time-machine' container of the 'analytics-pod' pod. | Command:
```bash
kubectl exec analytics-pod -c time-machine -- 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 ... |
Forward local port 3000 to port 6379 of a pod selected by the 'search-engine-deployment' deployment | Command:
```bash
kubectl port-forward deployment/search-engine-deployment 3000 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 wil... |
Import the environment variables from the ldap-credentials-secret secret and set them as environment variables in the authentication-service-deployment deployment. | Command:
```bash
kubectl set env --from=secret/ldap-credentials-secret deployment/authentication-service-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... |
View the last-applied-configuration annotations for the 'pod.yaml' file in JSON format | Command:
```bash
kubectl apply view-last-applied -f pod.yaml -o json
```
What it does:
View the latest last-applied-configuration annotations by type/name or file.
The default output will be printed to stdout in YAML format. You can use the -o option to change the output format.
Syntax:
`kubectl apply view-last-appli... |
Create an ingress called 'api-ingress' that routes requests from website.com/bar to svc1:8082 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress api-ingress --rule="website.com/bar=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": ... |
Add a taint labeled 'dedicated' to nodes with the label 'app=web-app' | Command:
```bash
kubectl taint node -l app=web-app dedicated=backup-node-14:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage":... |
Open the db-service service for editing using the vi editor. | Command:
```bash
KUBE_EDITOR="vi" kubectl edit svc/db-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, or fa... |
Access the shell of the first pod in the email-service service and run the 'wp' command. | Command:
```bash
kubectl exec svc/email-service -- wp
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.kube... |
Start streaming the logs of the cyber-sleuth container in the cdn-service-pod pod | Command:
```bash
kubectl logs -f -c cyber-sleuth 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": "--container", ... |
Create a new secret named "app-config-secret" with keys for each file in the "path/to/preferences" folder | Command:
```bash
kubectl create secret generic app-config-secret --from-file=path/to/preferences
```
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 basenam... |
Create a new config map named global-config with key1=config1 and key2=config2 | Command:
```bash
kubectl create configmap global-config --from-literal=conf=config1 --from-literal=data=config2
```
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 ... |
Run the 'ash' command in the first container of the pod in the 'proxy-service-deployment' deployment, and retrieve the output. | Command:
```bash
kubectl exec deploy/proxy-service-deployment -- ash
```
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 t... |
List the replication controllers with the name 'web', the service with the name 'gateway-rc', and the pod with the name 'frontend-pod'. | Command:
```bash
kubectl get rc/web service/gateway-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 yo... |
Import the SECRET_KEY from the config map "ui-config" into the deployment "cache-cluster-deployment" | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/ui-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 variable definitions... |
Update the pod named 'api' with a label 'component' and a value 'api' | Command:
```bash
kubectl label pods api component=api
```
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 ... |
Forward port 6379 on localhost and IP address 10.19.21.23 to port 8081 in the pod named api-service-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/api-service-pod 6379: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 cri... |
Output the modified payment-processor-deployment deployment in YAML format, with the environment variable "PORT" set to "8080", without making any changes to the actual deployment on the server. | Command:
```bash
kubectl set env deployment/payment-processor-deployment PORT=8080 -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 tem... |
Create a new LoadBalancer service named security-service-lb, mapping port 8000 on your local machine to port 3306 on the service. | Command:
```bash
kubectl create service loadbalancer security-service-lb --tcp=8000:3306
```
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",... |
Copy the local file /var/run/secrets/kubernetes.io/serviceaccount/ to the remote pod named openfaas/payment-gateway-pod-19 in the namespace | Command:
```bash
kubectl cp /var/run/secrets/kubernetes.io/serviceaccount/ openfaas/payment-gateway-pod-19:/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... |
Expose a replication controller as a service with specific ports | Command:
```bash
kubectl expose -f ubuntu-controller.yaml --port=5432 --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... |
Create a pod using the data in the conf.json file | Command:
```bash
kubectl create -f ./conf.json
```
What it does:
Create a resource from a file or from stdin.
JSON and YAML formats are accepted.
Syntax:
`kubectl create -f FILENAME`
Helpful flags:
"flag": "--filename", "short": "-f", "default": "[]", "usage": "Filename, directory, or URL to files to use to create t... |
Create a MySQL pod and keep it running in the foreground without automatic restart | Command:
```bash
kubectl run -i -t busybox --image=mysql --restart=Never
```
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... |
Import the REDIS_HOST key from the app-secrets config map and set it as an environment variable in the monitoring-stack-deployment deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-secrets deployment/monitoring-stack-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... |
Import the specific keys 'external_api_url' from the 'app-secrets' ConfigMap and set them as environment variables in the 'authentication-service-deployment' deployment. | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-secrets deployment/authentication-service-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 var... |
Set the cluster for the testing-context context to kube-cluster-2 | Command:
```bash
kubectl config set contexts.testing-context.cluster kube-cluster-2
```
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 yo... |
Create a copy of the email-service-pod in an interactive session, adding a debug container named debug-image-api with the debian image | Command:
```bash
kubectl debug email-service-pod -it --copy-to=debug-image-api --image=debian --set-image=api=api:v2,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 name... |
Create a new secret named ssl-key-secret using an environment file | Command:
```bash
kubectl create secret generic ssl-key-secret --from-env-file=path/to/preferences.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 the ba... |
Import specific keys from a config map into a deployment | Command:
```bash
kubectl set env --keys=smtp_server --from=configmap/app-config-dev 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... |
Set the CPU and memory limits of the CentOS container in the deployment called "centos" to "100m" and "64Mi" respectively. | Command:
```bash
kubectl set resources deployment centos -c=nginx --limits=cpu=100m,memory=64Mi
```
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... |
Update the label of the pod 'media-stream' to 'role=backend' | Command:
```bash
kubectl label pods media-stream role=backend
```
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", "usag... |
Update the image of all containers in the daemonset named "namespace-1" to "alpine:3.14" | Command:
```bash
kubectl set image daemonset namespace-1 *=alpine:3.14
```
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:
`... |
Forward traffic from port 8088 on localhost and IP 10.19.21.23 to port 5432 in the pod named cdn-service-pod | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/cdn-service-pod 8088:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the cri... |
Set the cluster field in a specific context | Command:
```bash
kubectl config set contexts.team-beta-context.cluster kube-cluster-2
```
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 ... |
Remove taints with key 'zone' from node 'edge-node-10' | Command:
```bash
kubectl taint nodes edge-node-10 zone-
```
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|nam... |
View CPU and memory usage for a specific pod and its containers | Command:
```bash
kubectl top pod api-service-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 p... |
Update the pod identified in the "conf.json" file with the environment annotation set to "staging" | Command:
```bash
kubectl annotate -f conf.json 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 arbitrary string v... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-settings deployment/log-aggregator-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definit... |
Create a deployment named "wordpress" using the "ethereum/client-go" image and expose port 8010. | Command:
```bash
kubectl create deployment wordpress --image=ethereum/client-go --port=8010
```
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 fo... |
Add a taint with key 'hardware' on nodes having label role=database | Command:
```bash
kubectl taint node -l role=database hardware=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": "... |
Create a service for the php deployment, which serves on port 80 and connects to the containers on port 8000. | Command:
```bash
kubectl expose deployment php --port=3306 --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 specified ... |
Get output from running the 'docker run -it ubuntu' command in the nano-bot container of the chat-app-pod pod. | Command:
```bash
kubectl exec chat-app-pod -c nano-bot -- docker run -it ubuntu
```
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 omi... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-secrets deployment/authentication-service-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 ... |
Import specific keys from a config map into the environment variables of a deployment. | Command:
```bash
kubectl set env --keys=REDIS_HOST --from=configmap/app-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 definitions i... |
Start a new pod named nginx using the ubuntu image, with some custom specifications provided in the JSON file passed to the --overrides flag. | Command:
```bash
kubectl run nginx --image=ubuntu --overrides='{ "apiVersion": "stable-2.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] -- [... |
Forward local ports 5432 and 6000 to ports 3000 and 6000 in a pod selected by the deployment | Command:
```bash
kubectl port-forward deployment/monitoring-stack-deployment 5432 3000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod ... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/app-config-prod 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.