Questions tagged [kubectl]

The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs.

3648 questions
1
vote
1 answer

how to display nodes information with a JSON request?

I know how to use the API to perform simple request such as display node information selecting node by labels value. For example : curl http://localhost:8080/api/v1/nodes?labelSelector=kubernetes.io/role%3Dworker3 Display informations about node…
nizery
  • 21
  • 4
1
vote
1 answer

How do I copy a local file to a pod's container in my minikube cluster using the Go client?

My query is pretty much what the title says, I have a local file say file.txt and I want to copy it into pod1's container container1. If I was to do it using kubectl, the appropriate command would be : kubectl cp file.txt pod1:file.txt -c…
infinite-blank-
  • 177
  • 2
  • 8
1
vote
1 answer

Passing params via configMap to Spring boot application in GKE google cloud

I'm configuring app to works in Kubernetes google cloud cluster. I'd like to pass parameters to application.properties in Spring boot application via configMap. I'm trying to pass value by Environment Variable. I've created config map in google…
1
vote
1 answer

Configure Kubectl to connect to a local network Kubernetes cluster

I'm trying to connect to a kubernetes cluster running on my Windows PC from my Mac. This is so I can continue to develop from my Mac but run everything on a machine with more resources. I know that to do this I need to change the kubectl context on…
Bailey S
  • 597
  • 1
  • 6
  • 13
1
vote
1 answer

Kubectl exec running a bash command with special character

I am trying to run the following command on a pod from my local machine. kubectl -n myns exec mypod -- /bin/bash -c "err=$(tar -cvzf /tmp/logs_aj.tgz ${all_files} 2>&1) || ( export ret=$?; [[ $err == *"No such file or directory"* ]] || exit "$ret"…
codec
  • 7,978
  • 26
  • 71
  • 127
1
vote
1 answer

Kubectl appears to be discarding standard output

I'm trying to copy the contents of a large (~350 files, ~40MB total) directory from a Kubernetes pod to my local machine. I'm using the technique described here. Sometimes it succeeds, but very frequently the standard output piped to the tar xf…
Ed MacDonald
  • 126
  • 1
  • 5
1
vote
1 answer

error: unexpected EOF when kubectl cp dump.rdb file to local

I have this redis instance in a pod running on 1.21 cluster. Running kubectl cp -c redis --request-timeout=1m redis-pod:data/dump.rdb /tmp/data/dump.rdb or kubectl exec --request-timeout=1m -i redis-pod -- cat /data/dump.rdb > /tmp/data/dump.rdb I…
RicHincapie
  • 3,275
  • 1
  • 18
  • 30
1
vote
1 answer

How can I expose my postgresSQL pods with LoadBalancer service?

I setup 1 master node and 2 worker nodes on bare matel server. I deploy my postgressSQL with 3 replica sets. This is my deployment file. apiVersion: apps/v1 kind: Deployment metadata: name: postgres spec: selector: matchLabels: app:…
1
vote
1 answer

How do I delete a Kubernetes Namespace with a Cronjob?

I have a cron that's I'm testing for another project that is supposed to delete a namespace called "test" every minute. I have set up a ServiceAccount, ClusterRole, and RoleBinding as shown below: apiVersion: v1 kind: ServiceAccount metadata: …
TeeTee
  • 99
  • 7
1
vote
1 answer

Error when trying to create a deployment using YAML: Deployment in version "v1" cannot be handled as a Deployment

I am new to K8S and trying to create a deployment using the below YAML file. apiVersion: apps/v1 kind: Deployment metadata: name: building-apps-deploy labels: app: kubeacademy spec: replicas: 2 selector: matchlabels: app:…
DT1421
  • 23
  • 1
  • 3
1
vote
2 answers

Delete pods using kubectl containing a substring

When I run the command kubectl get pods | grep "apisix", I get the following data apisix-dev-78549978b7-pvh2v 1/1 Running 6 (4m19s ago) 8m14s apisix-dev-dashboard-646df79bf-mwkpc 1/1 …
Mahesh
  • 1,117
  • 2
  • 23
  • 42
1
vote
1 answer

JSON path semantics different in kubectl and additional printer columns in custom resource definition

I use kubectl to list Kubernetes custom resources of a kind mykind with an additional table column LABEL that contains the value of a label a.b.c.com/key if present: kubectl get mykind…
1
vote
0 answers

How do you retrieve pod logs by labelSelector when using the k8s HTTP API?

I would like to collect the logs from one or more related pods using a labelSelector and the kubernetes HTTP API. However, I don't see any way to do this without first knowing all the pods names,…
1
vote
2 answers

Get logs from all pods in namespace using xargs

Is there anyway to get all logs from pods in a specific namespace running a dynamic command like a combination of awk and xargs? kubectl get pods | grep Running | awk '{print $1}' | xargs kubectl logs | grep value I have tried the command above…
placplacboom
  • 614
  • 8
  • 16
1
vote
1 answer

Command for listing all the possible values you can put in the yaml

For example I want to list all the possible values I can put in the yaml file to create a Pod. I want to also look at the meanings of those values. e.g. in the container section you put in the details of the container
james pow
  • 336
  • 2
  • 11