prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
Listen on port 5000 on localhost and IP address 10.19.21.23, and forward the traffic to port 6379 in the 'web-app-pod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/web-app-pod 5000: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 custom TLS server name to "data-cluster" for validation for the "prod-cluster" cluster entry. | Command:
```bash
kubectl config set-cluster prod-cluster --tls-server-name=data-cluster
```
What it does:
Set a cluster entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values for those fields.
Syntax:
`kubectl config set-cluster NAME [--server=server] [--certificate... |
Check if you have permission to list the "report-generation-job" in the "kube-ingress" namespace. | Command:
```bash
kubectl auth can-i list jobs.batch/report-generation-job -n kube-ingress
```
What it does:
Check whether an action is allowed.
VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. NONRESOURCEURL is a par... |
Stream the logs from all containers in pods with the label "service=auth" | Command:
```bash
kubectl logs -f -l service=auth --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": "--contai... |
Set the custom TLS server name "cluster-alpha" for the "kube-cluster-2" cluster entry in the Kubernetes configuration. | Command:
```bash
kubectl config set-cluster kube-cluster-2 --tls-server-name=cluster-alpha
```
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] [--certific... |
Auto scale the deployment named "backend" with a minimum of 4 pods and a maximum of 14 pods. | Command:
```bash
kubectl autoscale deployment backend --min=4 --max=14
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
start a redis pod named "hazelcast" with the image "redis" and expose port 8000 | Command:
```bash
kubectl run hazelcast --image=redis --port=8000
```
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... |
Update the 'email' pod by setting the annotation 'deployment-script' with the value 'https://example.com/deploy.sh' | Command:
```bash
kubectl annotate pods email 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 than l... |
Dump the cluster information for the specified namespaces into the /tmp/foo_dir directory. | Command:
```bash
kubectl cluster-info dump --namespaces default,kube-system --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... |
Set the custom TLS server name to 'on-prem-cluster' for the 'my-k8s-cluster' cluster entry | Command:
```bash
kubectl config set-cluster my-k8s-cluster --tls-server-name=on-prem-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] [--certif... |
Forward traffic from local port 9090 to port 3000 in the web-app-pod deployment. | Command:
```bash
kubectl port-forward pod/web-app-pod 9090 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 automa... |
Forward traffic between local port 8088 and pod port 8088 in the 'proxy-server-pod' pod | Command:
```bash
kubectl port-forward pod/proxy-server-pod 8088 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 a... |
Partially update the node "k8s-node-1" by applying the YAML patch specified as "data:\n key: new-value" | Command:
```bash
kubectl patch node k8s-node-1 -p $'data:\n key: new-value'
```
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 flags:... |
Forward traffic from port 6379 on your local machine to port 3000 in the pod named "e-commerce-pod" | Command:
```bash
kubectl port-forward pod/e-commerce-pod 6379: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 aut... |
Create a secret named ssh-key-secret and populate it with values from an environment file | Command:
```bash
kubectl create secret generic ssh-key-secret --from-env-file=path/to/configurations.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... |
Add a taint with the key 'hardware' on nodes that have the label 'role=database' | Command:
```bash
kubectl taint node -l role=database hardware=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": "O... |
List deployments in JSON output format for the "feature-branch-2.3.0" version of the "my-apps" API group | Command:
```bash
kubectl get deployments.feature-branch-2.3.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 namespac... |
Create a cron job named log-rotation with the image mysql, schedule it to run every minute, and run the command "mysql --version" within the container | Command:
```bash
kubectl create cronjob log-rotation --image=mysql --schedule="*/1 * * * *" -- mysql --version
```
What it does:
Create a cron job with the specified name.
Syntax:
`kubectl create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "... |
Create a new secret named "database-secret" with the key1 value set to "supersecret" and the key2 value set to "topsecret" | Command:
```bash
kubectl create secret generic database-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
```
What it does:
Create a secret based on a file, directory, or specified literal value.
A single secret may package one or more key/value pairs.
When creating a secret based on a file, the key... |
List deployments in "v1.1.0" version of "internal-apps" API group in JSON format. | Command:
```bash
kubectl get deployments.v1.1.0.internal-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 w... |
Create a debug copy of the gateway-pod and change all container images to wordpress | Command:
```bash
kubectl debug gateway-pod --copy-to=debug-image-app --set-image=*=wordpress
```
What it does:
Debug cluster resources using interactive debugging containers.
'debug' provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no r... |
Create a new ClusterIP service named analytics-service-clusterip that listens on port 3001 and forwards traffic to port 9092. | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=3001: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": "-... |
Create a job named 'scaling-job' using the 'mongo' image, and run the 'mongod' command in the job. | Command:
```bash
kubectl create job scaling-job --image=mongo -- mongod
```
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... |
Change the service account of the deployment "monitoring-stack-deployment" to "elasticsearch" | Command:
```bash
kubectl set serviceaccount deployment monitoring-stack-deployment elasticsearch
```
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
Synt... |
Create a job with a command to run the 'wp' command using the 'wordpress' image | Command:
```bash
kubectl create job monitoring-job --image=wordpress -- wp
```
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 a new config map named app-config-prod from an env file | Command:
```bash
kubectl create configmap app-config-prod --from-env-file=path/to/parameters.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... |
Forward local port 6379 to port 8080 in the pod "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 6379:8080
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected... |
Embed the certificate authority data for the "cloud-cluster" cluster entry | Command:
```bash
kubectl config set-cluster cloud-cluster --embed-certs --certificate-authority=~/.kube/cluster-beta/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... |
Mark the node "db-node-7" as unschedulable | Command:
```bash
kubectl cordon db-node-7
```
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 " |
Create an ingress called 'public-service-ingress' that directs requests to foo.com/bar to a service named svc1 on port 5432, using the TLS secret named "my-cert". | Command:
```bash
kubectl create ingress public-service-ingress --rule="foo.com/bar=svc1:5432,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": "", "u... |
Apply a taint with key 'workload' and value 'web-node-8:PreferNoSchedule' to all nodes with the label 'role=database' | Command:
```bash
kubectl taint node -l role=database workload=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": "", "usage": "O... |
Update the service account of the 'database-deployment' deployment to 'dashboard' | Command:
```bash
kubectl set serviceaccount deployment database-deployment dashboard
```
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 an ingress named 'public-ingress' with the following rules: | Command:
```bash
kubectl create ingress public-ingress --rule="foo.com/module=svc1:5001,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage"... |
Create a pod disruption budget named batch-processing-pdb that selects pods with the version=v2 label and requires at least 9 of them to be available at any point in time. | Command:
```bash
kubectl create poddisruptionbudget batch-processing-pdb --selector=version=v2 --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=... |
Listen on port 8080 on all addresses, forwarding to port 5000 in the 'mypod' pod | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 8080: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 sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.