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.
3,657
questions
-1
votes
3
answers
40
views
Unable to run a Shell inside a k8s pod
When I run the command kubectl exec -it backstage-test01-5d877c7f54-425s6 -n customer-namespaces -- /bin/bash it returns this error :
Defaulted container "linkerd-proxy" out of: linkerd-...
-1
votes
0
answers
18
views
I'm creating a kubernetes cluster setup in ec2 using kubeadm I want to expose my frontend application through the internet with Load Balancer Service [closed]
I do not want to complicate with an ingress controller because its for learning purposes and I want to use LB service type, but I'm a bit confused about how the cloud controller manager works and even ...
0
votes
0
answers
7
views
Microk8s gpu alloc by vram size
I have microk8s node with different type gpu. ( RTX A5000, Rtx A2000)
I install nvidia-gpu-operator and it reports this node has two "nvidia.com/gpu"
my labelallocatable gpu is 2
Two gpu has ...
0
votes
0
answers
21
views
How to disable pod editing in kubernetes
I have a cluster on Azure composed by some pods installed by helmfile and managed by kubernetes. Now all users can execute kubectl edit on the pods and can change docker image version and environment ...
0
votes
2
answers
71
views
Does "kubectl logs -f -l" follow newly created pod?
kubectl logs -f with label seclection by -l like the followings:
$ kubectl logs -f -l 'role=job'
shows all pods matching the label-selection and keep the streamed logs.
What happens when a pod is ...
0
votes
1
answer
20
views
How to exclude fields in kubectl get
When running kubectl get -o yaml, I would like to filter out the annotation kubectl.kubernetes.io/last-applied-configuration so results are easier to read. Is there a native way of doing this with ...
0
votes
2
answers
47
views
How do I log into ECR to pull images if I can't use docker as a runtime?
One of the steps to log into ECR required to pull and push images is the following, according to AWS (https://docs.aws.amazon.com/AmazonECR/latest/userguide/getting-started-cli.html):
aws ecr get-...
0
votes
1
answer
25
views
How do I use "kubectl" instead of the path to the kubectl.exe in Powershell
When I run Kubernetes commands, Powershell is wanting me to use the path to the kubectl.exe instead of just using the command kubectl.
I'm told using an Alias would work but I'm not sure how to do ...
0
votes
0
answers
15
views
Facing intermittent timeout issues with GKE [closed]
So there are two VMs in different network , One on Private VPC of Gcloud lets call it GCVM , and another being on-premise OPVM , both VMs have appropirate permissions to access Kubernetes Cluster , ...
0
votes
0
answers
9
views
How to activate bash-completion for cnpg's kubectl plugin when running on a local k3s node?
cnpg completion will work when running like this:
. <( kubectl cnpg completion bash )
however, when running on a k3s node, the proper way to run kubectl is either:
k3s kubectl ...
or, make the /...
0
votes
0
answers
23
views
How to add bash auto completion to `k3s kubectl ...`?
I add bash-completion for k3s by running:
. <( k3s completion bash )
When I run the following, I only get bash-completion for kubectl ... and not k3s kubectl ...:
. <( k3s kubectl completion ...
0
votes
0
answers
22
views
How to change namespace by Rancher kubectl
I installed rancher via podman and created a namespace. Now when I start the kubectl shell via the UI, I am not able to change the namespace via:
kubectl config set-context --current --namespace=XXX
...
-1
votes
0
answers
48
views
I get an error saying pod has unbound immediate PersistentVolumeClaims, but all my pvc are bound. What do I do? I have followed exactly the tutorial
thanks for reading my issue. I am following this tutorial on deploying a MSSQL server to AKS, but on deploying, the pod won't run. I am unsure why.
So all I really did was git clone the sample-helm-...
0
votes
1
answer
34
views
Kubernetes: Need advice deleting a list of pods with pause in-between deletions
Good day.
Is there a Kubernetes pod deletion method for deleting a list of 48 pods while waiting until the previous pod has 'Running' status before deleting the next pod in the list?
I tried using a ...
0
votes
1
answer
21
views
Is there a reference of default kubectl column templates?
Is there a way to get from kubectl the default template of the output, if not, is there an online resource for these?
It doesn't matter which format it outputs, I'm just interested in a reference of ...
0
votes
0
answers
26
views
Using --sort-by with kubectl get pods --all-namespaces to sort by both namespace AND name doesn't work
I'm guessing at this point the answer is a big fat NO. I'm reaching the hive mind here for a clear answer of why, or in case I'm wrong (which I really hope I am) for a concrete example.
I've been able ...
0
votes
1
answer
36
views
How to execute a shell command in Pod B from Pod A using Kubertenes client in GKE
I have a server deployment with Horizontal scaling. The deployment will have 3-5 pods at any given time based on the load.
I use volume mapping to pass configuration data to the deployed server pods. ...
0
votes
1
answer
67
views
One-off kubectl run with file
I would like to execute a one-off in a Kubernetes cluster, however using a file from the local file system. Something like:
kubectl run mytmpjob --rm --restart='Never' \
--command <some-command-...
0
votes
1
answer
30
views
"kubectl --template". How can I understand it?
I can't catch up what is the difference between
kubectl.....-o jsonpath='{...}' and kubectl....--template='{{...}}'
Are they both just for retrieving data?
I know well about the jsonpath flag.
But ...
0
votes
0
answers
20
views
Access failing for private endpoint in Oracle kubernetes cluster
I am trying to connect to a private Oracle OKE cluster but it is failing with below error
$ sudo kubectl get nodes
E0912 15:34:18.729625 57232 memcache.go:265] couldn't get current server API ...
1
vote
0
answers
23
views
Periodic "Connection Refused" errors when using kubectl on AWS EC2
I have an AWS EC2 machine with the following specification:
Instance Name
vCPUs
RAM
EBS-Optimized Bandwidth
Network Bandwidth
c5a.8xlarge
32
64 GiB
3.170 Gbps
10 Gbps
I installed Kubernetes on it ...
0
votes
2
answers
18
views
Using Nodejs to parse kubectl output "TypeError: item.spec.map is not a function"
Using nodejs trying to parse attribute value(number of replicas) by running child_process kubectl deployment json output
Can you please suggest what I am doing wrong??
** Error: var deploymentInfo = ...
0
votes
0
answers
21
views
kubectl fails to fetch Argocd resource of type Application when kubectl inside a container
We have a gke cluster and we have installed ArgoCD on it. When we run the command locally to get applications:
kubectl get applications -n argocd the list of Application resources can be seen.
Then, ...
-2
votes
0
answers
16
views
Do DigitalOcean block storages allow multiple pods to access them?
I would like to create a volume that multiple pods can access. I want that volume to be in a block storage. However, I have seen that block storages don't allow for ReadWriteMany.
But it also says ...
0
votes
0
answers
53
views
Kubenetes deployment get failed, got "Liveness probe failed: HTTP probe failed with statuscode: 503" error
Kubernetes cluster was already there, I want to deploy latest version of the code, when updating the docker image version, newly created pod starts throwing error Liveness probe failed: HTTP probe ...
0
votes
1
answer
43
views
Unable to place the Pods Evenly
No matter how hard I tune this, I am not able to make the Pods spread evenly across the four nodes in AWS EKS Cluster. Here's the Pod yaml.
nodeSelector:
node_env: my-node-name
affinity:
...
0
votes
0
answers
21
views
Unable to get results when querying the Azure DNS zone list
I am following this tutorial to create a cloud based app.
I am very unfamiliar with Azure as its my first time doing something like this. On unit 7, it instructs me to run this command in bash:
az aks ...
-1
votes
1
answer
64
views
How to update a statefulset?
I have a stateful set that I want to update but I get the error:
The StatefulSet "postgres" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', '...
0
votes
0
answers
38
views
How to update the public IP of AWS EC2 instance in Route53
I'm running a k8s cluster in AWS and I got the following error after I ran kubectl get cluster-info:
E0902 13:22:08.516718 897 memcache.go:265] couldn't get current server API group list: Get &...
0
votes
1
answer
53
views
How to find out the API group a resource belongs to?
In my k3s cluster, I am editing a Role to add permission to a resource e.g. deployment.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: "2023-09-02T08:00:23Z&...
0
votes
1
answer
64
views
Retrieve Logs of Deleted Pods in Airflow Running on Kubernetes
I'm running Apache Airflow on a Kubernetes cluster and I'm facing an issue with retrieving logs from deleted pods. I can easily get logs from currently running or recently terminated pods using ...
0
votes
1
answer
35
views
kubectl- The connection to the server x.x.x.:6443 was refused - did you specify the right host or port?
I have set up a kubernetes cluster with a master node and a worker node. I am facing below error whenever I run a kubectl command-
The connection to the server x.x.x.:6443 was refused - did you ...
0
votes
1
answer
24
views
Using Nodeport to access api in pod Kubernetes Service
I created a nodeport service on a port 12345, to access my api running on node 6666, deployed through a pod. The pod is deployed in multiple nodes.
ports:
- port: 8181
targetPort: 6666
...
-1
votes
0
answers
61
views
How to set default kubectl namespace inside a pod
I know I can set the default namespace for kubectl in this way:
kubectl config set-context --current --namespace=NAMESPACE
But when running inside a pod, there is no current context, so I cannot set ...
-1
votes
0
answers
25
views
How to check which process is taking how much memory in a k8 pod [duplicate]
How to check which process is taking how much memory in a k8 pod.
How to list down all the processes running in a pod and their memory usage.
0
votes
1
answer
19
views
How do I get a List of all the Service in Kubernetes using kubectl
How do I get a List of all the Service in Kubernetes using kubectl
ks get services -o jsonpath='{range .items[*]}{.metadata.name}.
{.metadata.namespace}.svc.cluster.local{"\n"}{end}'
...
0
votes
0
answers
56
views
Kube API extension server client-cert-based authorization does not work with kubeconfig file client-certificate-data
Currently on k8s 1.24.13
I have client cert auth enabled and functioning normally (almost) from my extension api-server using the client-ca-file option with clients presenting certs in which the ...
1
vote
1
answer
54
views
How to list all resource to secret mappings?
I am looking for a kubectl command that will list everywhere a secret is referenced.
Example output:
deploymentABC - secretkeyname1
deploymentXYZ - secretkeyname2
statefulset123 - secretkeyname1
I ...
-1
votes
1
answer
37
views
Query kubectl resources in config file
I have a yaml file that looks like this
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: hello-cron-job
namespace: hello-world
spec:
schedule: "0 * * * *"
jobTemplate:
spec:...
0
votes
1
answer
27
views
unable to get restarted/crashed pod's log from previous option
My k8s pod gets terminated/crashed sometimes and restarts automatically. When I try to see the old log to debug for the crash, I get the below error. If terminated container not found, then how can I ...
0
votes
0
answers
31
views
Node CLI commands through kubectl exec pod_name --
I am trying to build a script, which would be running database queries on a pod, after loading node CLI. Manually, i run kubectl exec pod_name -- node test.js, and that would give me a CLI and I run ...
0
votes
1
answer
40
views
How do nodes communicate with each other in a Kubernetes cluster?
I executed the kubectl get nodes -o wide command, and in the results, there is a column labeled INTERNAL-IP, which displays the internal IP for each node. I would like to understand if the nodes use ...
0
votes
0
answers
19
views
Minikube's kubectl path. Where is kubectl?
Kubectl is included with minicube. I use it. I need path to minikube's kubectl to use VS Code's Kubernetes extension. I don't want to install kubectl separetely
Chat GPT suggested me:
echo "$(...
0
votes
1
answer
15
views
Error when running minikube tutorial export POD_NAME
I'm running the kubernets bootcamp tutorial using minikube and one of the tutorial asks to register the POD_NAME by running a command:
export POD_NAME="$(kubectl get pods -o go-template --...
0
votes
0
answers
80
views
Terraform error - failed to create kubernetes rest client for read of resource: yaml: line 23: mapping values are not allowed in this context kubectl
Running into an issue while running terraform scripts ('terraform init' works, then terraform apply or terraform destory gives the following error):
│ Error: failed to create kubernetes rest client ...
0
votes
1
answer
20
views
Where does kubectl store its logs?
I'm trying to locate any logs that kubectl may store related to errors raised locally in the process of executing kubectl commands. I can't find any documentation of where logs for the CLI itself may ...
0
votes
1
answer
48
views
How to edit a kubernetes secret using Rust?
I want to update a secret. It has a data field, the value of which needs to be updated. In Rust, I can use the APIs create and delete but there is no update or edit.
However, I can use kubectl edit ...
0
votes
1
answer
23
views
Minikube cluster not working correctly on windows - web app not loading
I'm trying to develop a simple cluster using minikube on my local machine.
Minikube is running on top of docker as a container.
I was unable create image and up and run containers. for that, i upload ...
0
votes
0
answers
38
views
JSON related error (maybe) on kubectl patch serviceaccount
I'm following this digital ocean tutorial and while running the steps, I had ran into an error regarding JSON.
No matter what I pass for -p, I always get the given error. Why? I'm on windows? ...