prompt stringlengths 13 282 | response stringlengths 128 3.11k |
|---|---|
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/dev-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/dev-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 s... |
Add a taint with key 'cpu-type' on nodes having label app-type=microservice, and the taint value is 'testing-node-11:PreferNoSchedule' | Command:
```bash
kubectl taint node -l app-type=microservice cpu-type=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": ""... |
Auto scale the replication controller "backend" with a minimum of 1 and a maximum of 5 pods, targeting a CPU utilization of 20%. | Command:
```bash
kubectl autoscale rc backend --max=5 --cpu-percent=20
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses... |
Update the cluster field for the my-context context to prod-cluster | Command:
```bash
kubectl config set contexts.user-b-context.cluster prod-cluster
```
What it does:
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
PROPERTY_VALUE is the new value you w... |
Import the LOG_LEVEL key from the app-name-config config map into the order-processing-deployment deployment. | Command:
```bash
kubectl set env --keys=LOG_LEVEL --from=configmap/app-name-config deployment/order-processing-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 def... |
Update the annotation 'git-repo' of the pod 'vpn' with the value 'https://github.com/example/my-app', overwriting any existing value. | Command:
```bash
kubectl annotate --overwrite pods vpn git-repo='https://github.com/example/my-app'
```
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 t... |
Get the output from the stardust-shuttle container in the e-commerce-pod. | Command:
```bash
kubectl attach e-commerce-pod -c stardust-shuttle
```
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 omitt... |
Import the environment variables from the 'oauth-secret' secret into the 'analytics-platform-deployment' deployment. | Command:
```bash
kubectl set env --from=secret/oauth-secret deployment/analytics-platform-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 mo... |
Create a new ClusterIP service named analytics-service-clusterip with a TCP port mapping | Command:
```bash
kubectl create service clusterip analytics-service-clusterip --tcp=5432:9090
```
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 cluster role named "reader" with the ResourceName specified as "backup-service" and "billing-service" | Command:
```bash
kubectl create clusterrole reader --verb=watch --resource=services --resource-name=backup-service --resource-name=billing-service
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|cl... |
Copy the file /tmp/foo from the remote pod task-processor-pod-17 in the kube-public namespace to the local directory /tmp/bar_dir. | Command:
```bash
kubectl cp kube-public/task-processor-pod-17::/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... |
Create a single ingress called 'api-v2-ingress' that directs requests to 'website.com/input' to service 'svc1' on port '9090' with a TLS secret called 'my-cert'. | Command:
```bash
kubectl create ingress api-v2-ingress --rule="website.com/input=svc1:9090,tls=my-cert"
```
What it does:
Create an ingress with the specified name.
Syntax:
`kubectl create ingress NAME --rule=host/path=service:port[,tls[=secret]]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usa... |
Create an ingress named 'service-ingress' that maps requests from testing.com/bar to svc1:8089 with a TLS secret named "my-cert" | Command:
```bash
kubectl create ingress service-ingress --rule="testing.com/bar=svc1:8089,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": "", "usag... |
Start a wordpress pod named "hazelcast" and configure the container to expose port 9092. | Command:
```bash
kubectl run hazelcast --image=wordpress --port=9092
```
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": "... |
Create a single ingress called 'website-ingress' that directs requests to website.com/module to svc1:8443 with a tls secret "my-cert" | Command:
```bash
kubectl create ingress website-ingress --rule="website.com/module=svc1:8443,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... |
Start a node pod with the name "nginx" and the image "node", using the spec values specified in the JSON override. | Command:
```bash
kubectl run nginx --image=node --overrides='{ "apiVersion": "v1.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] -- [COMMAND]... |
Update the environment variable LOG_LEVEL to info for the deployment proxy-service-deployment. | Command:
```bash
kubectl set env deployment/proxy-service-deployment LOG_LEVEL=info
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates ... |
Retrieve the logs from the container named 'proxy-server-pod-1' in the 'frontend-deployment-1' pods from the 'frontend-deployment' deployment. | Command:
```bash
kubectl logs deployment/frontend-deployment -c proxy-server-pod-1
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag... |
Create a new NodePort service named backend-nodeport with a TCP port mapping of 8089:3306 | Command:
```bash
kubectl create service nodeport backend-nodeport --tcp=8089:3306
```
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": "",... |
Create a job with a specific command | Command:
```bash
kubectl create job scaling-job --image=postgres -- postgres
```
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. O... |
Copy a file named "foo" from the "/tmp" directory of the pod "front-end-pod-12" to the "/tmp" directory locally. | Command:
```bash
kubectl cp logging/front-end-pod-12::/tmp/foo /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 kubectl.... |
Update the pod 'chat-app' by adding the annotation 'description' with the value 'Web server for marketing site' | Command:
```bash
kubectl annotate pods chat-app 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 larger than labe... |
Update the 'env' annotation of the 'api' pod to 'staging'. | Command:
```bash
kubectl annotate pods api 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 value... |
Copy the `~/.config/kube` file from the remote pod `openfaas/message-broker-pod-15` to the `/tmp/bar` directory locally. | Command:
```bash
kubectl cp openfaas/message-broker-pod-15:~/.config/kube /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 t... |
Listen on port 3000 on localhost and IP address 10.19.21.23, forwarding the traffic to port 5432 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 3000:5432
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a p... |
Create a new config map named app-config-prod with the specified keys instead of file basenames on disk. | Command:
```bash
kubectl create configmap app-config-prod --from-file=conf=/path/to/settings/file1.txt --from-file=data=/path/to/preferences/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating... |
Update the label of the pod 'gateway' to set the label 'unhealthy' to 'true' | Command:
```bash
kubectl label pods gateway unhealthy=true
```
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":... |
Set the runtime container limits for a deployment's nginx container to 100m CPU and 512Mi memory | Command:
```bash
kubectl set resources deployment runtime -c=nginx --limits=cpu=100m,memory=512Mi
```
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 ... |
Attach to the frontend-pod container quantum-quark | Command:
```bash
kubectl attach frontend-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... |
Listen on port 5000 on localhost and IP address 10.19.21.23, and forward the traffic to port 6379 in the log-aggregator-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/log-aggregator-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 ... |
Retrieve information about the replication controller named "web", the service named "database-rc", and the pod named "chat-app-pod". | Command:
```bash
kubectl get rc/web service/database-rc pods/chat-app-pod
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is namespaced y... |
Run the 'nginx -t' command inside the frontend-pod and print the output | Command:
```bash
kubectl exec frontend-pod -- nginx -t
```
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.kub... |
Partially update the monitoring-node-15 node by specifying a strategic merge patch in JSON format | Command:
```bash
kubectl patch node monitoring-node-15 -p '{"spec":{"rules":[{"http":{"paths":[{"path":"/","backend":{"service": {"name": "new-service"}}}]}}'
```
What it does:
Update fields of a resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
Syntax:
`ku... |
Create a service for a replication controller specified in "alpine-controller.yaml" file, which serves on port 5001 and connects to containers on port 844300. | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=5001 --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... |
Create an ingress called 'private-service-ingress' with a rule that directs requests from foo.com/module to the service 'svc1' on port 8181 | Command:
```bash
kubectl create ingress private-service-ingress --rule="foo.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": ""... |
Begin streaming the logs of the "astro-container" container in the "database-pod" pod. | Command:
```bash
kubectl logs -f -c astro-container database-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", ... |
Add a taint with key 'cpu-type' on nodes having the label region=eu-west-2 | Command:
```bash
kubectl taint node -l region=eu-west-2 cpu-type=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":... |
Import the "secret_key" from the "monitoring-config" config map into the "proxy-service-deployment" deployment | Command:
```bash
kubectl set env --keys=secret_key --from=configmap/monitoring-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 def... |
List deployments in YAML output format from the "feature-branch-2.3.0" version of the "third-party-apps" API group | Command:
```bash
kubectl get deployments.feature-branch-2.3.0.third-party-apps -o yaml
```
What it does:
Display one or many resources.
Prints a table of the most important information about the specified resources. You can filter the list using a label selector and the --selector flag. If the desired resource type is... |
Create a debug container in a copy of the cdn-service-pod, using the debian image | Command:
```bash
kubectl debug cdn-service-pod -it --copy-to=dgb-img --image=debian --set-image=api=api:v2,proxy=nginx:1.21
```
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 ... |
Create a hazelcast pod named 'hazelcast' using the 'hazelcast/hazelcast' image and expose port 8084 for the container | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=8084
```
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:... |
Import specific keys from a config map | Command:
```bash
kubectl set env --keys=SECRET_KEY --from=configmap/app-name-config deployment/notification-handler-deployment
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variabl... |
Forward traffic from port 3000 on localhost and IP 10.19.21.23 to port 5000 in the e-commerce-pod pod. | Command:
```bash
kubectl port-forward --address localhost,10.19.21.23 pod/e-commerce-pod 3000: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 crit... |
Update the image of all containers in the daemonset namespace-1 to 'debian:11.0' | Command:
```bash
kubectl set image daemonset namespace-1 *=debian:11.0
```
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 local port 8081 to port 6379 in the analytics-pod pod. | Command:
```bash
kubectl port-forward pod/analytics-pod 8081:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected auto... |
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/web-cluster/kubernetes.ca.crt' | Command:
```bash
kubectl config set-cluster staging-cluster --embed-certs --certificate-authority=~/.kube/web-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 s... |
Create a service for a replication controller using a YAML file, with a specified port and target port. | Command:
```bash
kubectl expose -f php-controller.yaml --port=8084 --target-port=909200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the sp... |
View previous terminated logs of nano-bot container in backend-pod | Command:
```bash
kubectl logs -p -c nano-bot backend-pod
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short":... |
taint nodes with label "app-type=microservice" as dedicated for storage | Command:
```bash
kubectl taint node -l app-type=microservice dedicated=storage-node-13:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "... |
Forward traffic from port 5432 on your local machine to port 3000 in the cdn-service-pod pod. | Command:
```bash
kubectl port-forward pod/cdn-service-pod 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 will be selected au... |
Forward traffic from port 3000 on all addresses to port 5000 in the pod named "analytics-pod" | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/analytics-pod 3000: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 wil... |
Create a job named "report-generation-job" with the image "mysql" and the command "mysql" | Command:
```bash
kubectl create job report-generation-job --image=mysql -- mysql
```
What it does:
Create a job with the specified name.
Syntax:
`kubectl create job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", "usage": "Output forma... |
Forward traffic from local port 5000 to port 8080 in the pod named "log-aggregator-pod" | Command:
```bash
kubectl port-forward pod/log-aggregator-pod 5000 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... |
Create a new ExternalName service named external-third-party-api-service and set the external name as demo-service.dev. | Command:
```bash
kubectl create service externalname external-third-party-api-service --external-name demo-service.dev
```
What it does:
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to refer... |
Execute the 'wp' command in the rocket-ranger container of the analytics-pod pod. | Command:
```bash
kubectl exec analytics-pod -c rocket-ranger -- 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... |
Copy the local file "/tmp/foo_dir" to the remote pod "auth-service-pod-11" in the "/tmp/bar" directory, specifically in the "payment-gateway" container. | Command:
```bash
kubectl cp /tmp/foo_dir auth-service-pod-11::/tmp/bar -c payment-gateway
```
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... |
Delete the "cluster-gamma" cluster configuration from the current kubeconfig file. | Command:
```bash
kubectl config delete-cluster cluster-gamma
```
What it does:
Delete the specified cluster from the kubeconfig.
Syntax:
`kubectl config delete-cluster NAME` |
Run the 'go' command inside the 'analytics-pod' pod and retrieve the output | Command:
```bash
kubectl exec analytics-pod -- 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 the kubectl.kubernet... |
Create a job named "database-seeding-job" with image "ruby" and command "irb" | Command:
```bash
kubectl create job database-seeding-job --image=ruby -- irb
```
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. O... |
Attach to the database-pod and get the output from the running pod | Command:
```bash
kubectl attach database-pod
```
What it does:
Attach to a process that is already running inside an existing container.
Syntax:
`kubectl attach (POD | TYPE/NAME) -c CONTAINER`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted, use the kubectl.ku... |
View the last-applied-configuration annotations of the deployment named 'mysql' in YAML format | Command:
```bash
kubectl apply view-last-applied deployment/mysql
```
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-applied ... |
Update the 'frontend' pod with the annotation 'custom-label' and the value 'my-custom-value'. | Command:
```bash
kubectl annotate pods frontend custom-label=my-custom-value
```
What it does:
Update the annotations on one or more resources.
All Kubernetes objects support the ability to store additional data with the object as annotations. Annotations are key/value pairs that can be larger than labels and include ... |
Expose a replication controller by creating a service with specified port and target port. | Command:
```bash
kubectl expose -f alpine-controller.yaml --port=9090 --target-port=909200
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the... |
Create a new config map named 'app-settings' using the specified files and keys | Command:
```bash
kubectl create configmap app-settings --from-file=properties=/path/to/options/file1.txt --from-file=key1=/path/to/configs/file2.txt
```
What it does:
Create a config map based on a file, directory, or specified literal value.
A single config map may package one or more key/value pairs.
When creating a... |
Set the CPU limit of the nginx container in the deployment named "node" to "1" and the memory limit to "128Mi". | Command:
```bash
kubectl set resources deployment node -c=nginx --limits=cpu=1,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 its... |
Return the snapshot logs from the first container of the notification-sender-job job. | Command:
```bash
kubectl logs job/notification-sender-job
```
What it does:
Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.
Syntax:
`kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]`
Helpful flags:
"flag": "--container", "short"... |
Set the service account for the deployment "search-engine-deployment" to "kube-controller-manager" | Command:
```bash
kubectl set serviceaccount deployment search-engine-deployment kube-controller-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), statefulse... |
Add a taint to a node with a specific key and no value | Command:
```bash
kubectl taint nodes monitoring-node-15 cpu-type: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. O... |
Port forward local port 5432 to port 5000 in the pod named backend-pod | Command:
```bash
kubectl port-forward pod/backend-pod 5432:5000
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be selected automa... |
Apply all resources defined in the kustomization.yaml file located in the 'config' directory. | Command:
```bash
kubectl apply -k config/
```
What it does:
Apply a configuration to a resource by file name or stdin. The resource name must be specified. This resource will be created if it doesn't exist yet. To use 'apply', always create the resource initially with either 'apply' or 'create --save-config'.
JSON and... |
Get output from running the 'mysql' command in the 'mycontainer' container of the 'monitoring-pod' pod. | Command:
```bash
kubectl exec monitoring-pod -c mycontainer -- mysql
```
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... |
Create a new LoadBalancer service named security-service-lb that maps port 8082 on the LoadBalancer to port 8080 on the service. | Command:
```bash
kubectl create service loadbalancer security-service-lb --tcp=8082:8080
```
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",... |
Create a deployment named 'jenkins' with the 'wordpress' image, and set the number of replicas to 2. | Command:
```bash
kubectl create deployment jenkins --image=wordpress --replicas=2
```
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 ... |
Update the 'media-stream' pod by setting the annotation 'SLA' to '99.9% uptime' | Command:
```bash
kubectl annotate pods media-stream SLA='99.9% uptime'
```
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 arbitr... |
Create a new ClusterIP service named log-service-clusterip | Command:
```bash
kubectl create service clusterip log-service-clusterip --tcp=7000:8089
```
What it does:
Create a ClusterIP service with the specified name.
Syntax:
`kubectl create service clusterip NAME [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]`
Helpful flags:
"flag": "--output", "short": "-o", "d... |
Auto scale the replication controller "analytics" to have a number of pods between 1 and 8, with a target CPU utilization of 90%. | Command:
```bash
kubectl autoscale rc analytics --max=8 --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... |
Create a service for the replication controller specified in the "nginx-controller.yaml" file | Command:
```bash
kubectl expose -f nginx-controller.yaml --port=6379 --target-port=808900
```
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 cluster role named "custom_role" with the ability to delete configmaps and access the resource names "auth-proxy" and "machine-learning" | Command:
```bash
kubectl create clusterrole custom_role --verb=delete --resource=configmaps --resource-name=auth-proxy --resource-name=machine-learning
```
What it does:
Create a cluster role.
Syntax:
`kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=serv... |
Set the client-key field for the api-user entry in the kubeconfig file, without modifying any other values | Command:
```bash
kubectl config set-credentials api-user --client-key=~/.kube/admin.key
```
What it does:
Set a user entry in kubeconfig.
Specifying a name that already exists will merge new fields on top of existing values.
Client-certificate flags:
--client-certificate=certfile --client-key=keyfile
Bearer token fl... |
get the list of deployments in the "custom-version" version of the "internal-apps" API group in YAML output format | Command:
```bash
kubectl get deployments.custom-version.internal-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 namespac... |
Automatically scale the replication controller "vpn" based on CPU utilization, with the number of pods between 1 and 8, and a target CPU utilization of 20% | Command:
```bash
kubectl autoscale rc vpn --max=8 --cpu-percent=20
```
What it does:
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the... |
Remove a taint from a specific node | Command:
```bash
kubectl taint nodes prod-node-5 datacenter: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... |
Import the "external_api_url" key from the "app-name-config" config map and set it as an environment variable in the "payment-processor-deployment" deployment. | Command:
```bash
kubectl set env --keys=external_api_url --from=configmap/app-name-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 vari... |
Create a new secret named payment-gateway-secret with keys for each file in folder bar | Command:
```bash
kubectl create secret generic payment-gateway-secret --from-file=path/to/parameters
```
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 bas... |
Create a deployment named app that runs the wordpress image and exposes port 8000 | Command:
```bash
kubectl create deployment app --image=wordpress --port=8000
```
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: j... |
Add a taint with key 'workload' on nodes having label cluster=my-cluster | Command:
```bash
kubectl taint node -l cluster=my-cluster workload=k8s-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... |
Listen on port 5432 on all addresses, forwarding to port 6379 in the 'mypod' pod. | Command:
```bash
kubectl port-forward --address 0.0.0.0 pod/mypod 5432:6379
```
What it does:
Forward one or more local ports to a pod.
Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted.
If there are multiple pods matching the criteria, a pod will be sel... |
Create a job named report-generation-job using the amazonlinux image | Command:
```bash
kubectl create job report-generation-job --image=amazonlinux -- /bin/bash -c "echo 'Hello
```
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": ... |
Create a job named log-processing-job using the Node image and execute the command `node --version` within the job. | Command:
```bash
kubectl create job log-processing-job --image=node -- node --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 ... |
Get the output of the 'ruby --version' command from the first pod in the 'database-deployment' deployment | Command:
```bash
kubectl exec deploy/database-deployment -- ruby --version
```
What it does:
Execute a command in a container.
Syntax:
`kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]`
Helpful flags:
"flag": "--container", "short": "-c", "default": "", "usage": "Container name. If omitted,... |
Update the environment variable to "prod" for all containers in all replication controllers in the project. | Command:
```bash
kubectl set env rc --all ENV=prod
```
What it does:
Update environment variables on a pod template.
List environment variable definitions in one or more pods, pod templates. Add, update, or remove container environment variable definitions in one or more pod templates (within replication controllers o... |
Import the 'secret_key' from the 'app-config-prod' config map into the 'payment-processor-deployment' deployment | Command:
```bash
kubectl set env --keys=secret_key --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 d... |
Create a service for a replicated Wordpress using a replica set, serving on port 9092 and connecting to the containers on port 8000 | Command:
```bash
kubectl expose rs wordpress --port=9092 --target-port=800000
```
What it does:
Expose a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector for that resource as the selector for a new service on the specified po... |
Delete a pod using the configuration specified in the params.json file. | Command:
```bash
kubectl delete -f ./params.json
```
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 resou... |
Forward local traffic from port 8080 to port 5432 in the cdn-service-pod. | Command:
```bash
kubectl port-forward pod/cdn-service-pod 8080 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 au... |
Add a taint on nodes with label stack=tech-stack | Command:
```bash
kubectl taint node -l stack=tech-stack environment=testing-node-11:PreferNoSchedule
```
What it does:
Update the taints on one or more nodes.
Syntax:
`kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N`
Helpful flags:
"flag": "--output", "short": "-o", "default": "", ... |
Create a service for an nginx deployment, which serves on port 8089 and connects to the containers on port 808000 | Command:
```bash
kubectl expose deployment nginx --port=8089 --target-port=808000
```
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 specifie... |
Retrieve the previous terminated logs of the stardust-shuttle container from the web-app-pod pod. | Command:
```bash
kubectl logs -p -c stardust-shuttle web-app-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", ... |
Start a pod named 'hazelcast' using the 'hazelcast/hazelcast' image and expose port 6379 | Command:
```bash
kubectl run hazelcast --image=hazelcast/hazelcast --port=6379
```
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:... |
Delete the pods and services with names "proxy" and "web" | Command:
```bash
kubectl delete pod,service proxy web
```
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.