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
2 answers

Use kubectl find out how many Deployments don't have a container called "main"

I want to be able to quickly figure out how many Deployments in a namespace don't have a container named "main". This is as close as I have got so far, using jq, which gives me a list of all container names: kubectl get deploy -o json | jq…
James Cockbain
  • 466
  • 2
  • 4
  • 13
1
vote
1 answer

Get ca-cert.pem field of a kubernetes secret

In my istio-system namespace, I have the following secret ▶ k get secret istio-ca-secret -o yaml apiVersion: v1 data: ca-cert.pem: LS0tLS1CR... ca-key.pem: LS0.. cert-chain.pem: "" key.pem: "" root-cert.pem: "" While the following query…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
1
vote
1 answer

Kubernetes patch multiple resources not working

I'm trying to apply the same job history limits to a number of CronJobs using a patch like the following, named kubeJobHistoryLimit.yml: apiVersion: batch/v1beta1 kind: CronJob spec: successfulJobsHistoryLimit: 1 failedJobsHistoryLimit: 1 My…
Tianxiang Xiong
  • 3,887
  • 9
  • 44
  • 63
1
vote
1 answer

Kubectl cannot connect while able to connect with Lens

I have kubectl installed in my system where when I run the below command, I get the error as $ kubectl get po --v=9 I0601 14:09:21.058688 24000 loader.go:372] Config loaded from file: [dir]\.kube\config I0601 14:09:21.060188 24000…
raaeusagvc
  • 71
  • 6
1
vote
0 answers

Issue with aad-pod-identity and nmi on same cluster

i have a cluster where i have aad-pod-identity installed like the instructions found here: https://azure.github.io/aad-pod-identity/docs/getting-started/installation/#helm That seemed to work fine for the most part, but because of other issues i…
Phil
  • 1,852
  • 2
  • 28
  • 55
1
vote
1 answer

Block externa-IP resolving in kubernetes

I have a created an nginx pod and nginx clusterIP service and assign an externalIP to that service like below NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE test-nginx ClusterIP …
prasanna kumar
  • 257
  • 3
  • 4
  • 17
1
vote
2 answers

IS there any Kubernetes API/kubectl command to delete older docker image?

Is there any kubernetes api or kubectl command to delete older docker images that is lying on the device. I know we can delete by using docker rm image but i want to do remotely through API. Any alternative?
1
vote
1 answer

How to change the name of a user in kube config file with kubectl?

How do you change the name of a user in a kube config file with kubectl (no text editor)? Example kube config file stage_config.yaml: apiVersion: v1 clusters: - cluster: certificate-authority-data: REDACTED server: https://127.0.0.1:6443 …
SlyGuy
  • 127
  • 1
  • 3
  • 13
1
vote
1 answer

How to scale a k8s deployment to "plus one pod"

Anyone knows any way, or controller, plugin, anything.. without knowing upfront the number of replicas of a deployment, to scale the deployment to plus one or more replicas. Like kubectl scale --replicas=+1 deployment/mysql Currently, as far as I…
JGG
  • 304
  • 2
  • 12
1
vote
2 answers

Use Kubectl access *existing* GCP cluster

I've been able to deploy things via helm, and even directly with a docker push to a GCP container. But I can't figure out how to get kubectl to access the GCP cluster. When I search for accessing a GCP cluster via kubectl, it always talks about…
Woodsman
  • 901
  • 21
  • 61
1
vote
1 answer

YAML placeholders with kubectl

I'm using below template in deployment.yaml apiVersion: v1 kind: Service metadata: name: httpbin-diffy labels: app: httpbin-diffy namespace: {{ Values.namespace.name }} and using separate values.yaml for namespace: name: diffy when I…
1
vote
3 answers

Kubectl Namespace script to filter only name

I'm trying to use Kubectl get namespaces command it is fetching the data. kubectl get namespace NAME STATUS AGE default Active 1d kube-node-lease Active 1d kube-public Active 1d kube-system Active …
1
vote
1 answer

Using Kubernetes client-go lang to change Node Condition Status

I need to patch or change the node condition status, any idea how to do that using go lang "k8s client" ? Edit: I can see that inside the Node interface there is patch, not sure about the usage, documentation lacks info about data should be sent,…
Sam
  • 345
  • 3
  • 14
1
vote
1 answer

Portforwarding a kubernetes pod using partial pod-name

I am working with a test environment that has around 10 kubernetes pods that I need to interact with a lot, especially port forwarding. It takes me a lot of time every day to list pods, get pod name and use that in a command. Since all my pods start…
Martijn
  • 240
  • 4
  • 22
1
vote
2 answers

Copy files from remote kubernetes pod to unix machine

I want to copy files from remote kubernetes pod(source) to unix machine(target). Source & Target can be two different clusters. Earlier, openshift pods were used, so i have used rsync to copy files. What would be the right replacement for rsync?…
Raja
  • 507
  • 1
  • 6
  • 24