3,681 questions
1
vote
1
answer
71
views
Why does kubectl create secret fail with an error stating it is not logged in?
When I try to run kubectl create secret generic from my pipeline it fails with the error:
error: You must be logged in to the server (the server has asked for the client to provide credentials)
Here ...
-6
votes
2
answers
178
views
How to filter recent logs with kubectl logs for a specific pattern?
I’m working with Kubernetes and I often need to check my application logs for specific keywords, but only within the most recent log entries.
For example, I can get the logs from my pod using:
kubectl ...
0
votes
0
answers
117
views
Why does kubectl logs --follow show duplicate output when used in a loop to watch Kubernetes Job logs?
I'm running a Kubernetes Job from a Jenkins pipeline and want to stream its logs until completion.
I currently use this pattern in a Bash script:
job_status_cmd_complete="kubectl get job ${...
0
votes
1
answer
310
views
How do you list all pods of a specific type using kubectl?
In the past I would use something like this
kubectl get svc --field-selector spec.type=LoadBalancer
kubectl get svc --field-selector spec.type=ClusterIP
However this stopped working when I updated ...
0
votes
1
answer
484
views
Kubelogin doesn't store access token locally [closed]
I have to use kubelogin to connect to a remote Kubernetes cluster.
Mac OS with version 15.4.1.
Installed kubelogin with Homebrew (only this is available way for Mac):
brew install Azure/kubelogin/...
-1
votes
1
answer
557
views
Error: failed to get token: initialing the device code authentication
I have installed the kubectl binary with curl and kubelogin with snap.
I am unable to connect to Azure Kubernetes Service (AKS) cluster recently with kubectl. I have seen that the connection steps ...
0
votes
1
answer
59
views
How to retrieve only the master node name using kubectl?
I am trying to get the name of the master (control-plane) node in my Kubernetes cluster using kubectl. I want the command to return only the name of the node without any additional information.
I have ...
0
votes
1
answer
804
views
Does AWS EKS 1.32 have issues creating services and targetgroupbinding?
I could create service and targetgroupbinding entities as described below with AWS EKS 1.31, few days back we upgraded to AWS EKS 1.32 and started getting issues while creating same services and ...
0
votes
1
answer
111
views
How to restore default docker destop's KUBECONFIG for demo-k8s
In my local windows dev environment, I've run
az aks get-credentials --resource-group $RG --name $AKS --overwrite-existing
kubectl now connects to AKS cluster.
How do I revert the KUBECONFIG to ...
0
votes
1
answer
150
views
How to set multiple kubeconfigs using powershell
The kubectl documentation says, we should use : to separate paths to multiple kubeconfig files, but it does not work in powershell:
> $env:KUBECONFIG="C:\Users\me\.kube\staging-config:C:\Users\...
0
votes
1
answer
149
views
Unable to connect to service in same namespace in kubernetes
I have 2 apps. One is config-server and other is business-logic-app that consumes data from config-server. Both are running on same namespace in Kubernetes (kubectl on my laptop). However, am getting ...
0
votes
0
answers
118
views
kubectl patch deployment to new configmap not working
I have two kube configmaps, one of them is being used in a deployment. The config maps, and the pod deployment are below
File : configmap.yml
apiVersion: v1
kind: ConfigMap
metadata:
name: mock-url-...
0
votes
1
answer
47
views
Does all the kubectl commands executed using put params in concourse explicitly do readiness check?
I m trying to deploy a docker container into Kubernetes using concourse ci put params, I could see after executing the kubectl command it explicitly checks for the readiness of all the others pods ...
0
votes
1
answer
146
views
Dependent Vars not resolving on kubectl
This is just a contrived example from https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/ I'm just trying to create this behavior using kubectl command (not ...
0
votes
2
answers
185
views
Deleting an OpenShift deployment with a Recreate Update strategy
In a Dev OpenShift sandbox I have the following kubernetes resources:
NAME READY STATUS RESTARTS AGE
pod/workspace036c85e5c44e4207-697d66f7c4-jbwcp ...
0
votes
1
answer
369
views
How can I use kubectl debug with a locally generated docker image?
I'm using Docker Destop as a local kubernetes provider. I'm tired to reinstall a few additional tools to my default alpine Docker image, so I generated a new one from Docker in order to hold every ...
2
votes
1
answer
129
views
Is there a way to get node level information in kubernetes pods?
I need low level information about the node, like number of cores, core ID and other things which is part of the kubelet in a pod running in the node. How do I get this?
0
votes
0
answers
147
views
Unable to install calico network on droplet with kubectl command
I am trying this
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
Error:
root@k8-master:~# kubectl apply -f calico.yaml error: error validating
"calico.yaml": error ...
0
votes
1
answer
171
views
How do i add custom column name in output of kubectl jsonpath query
I am using kubectl jsonpath query to display below output:
kubectl get pvc -o=jsonpath='{range .items[*]}{@.metadata.name}{" "}{@.spec.resources.requests.storage}{" "}{@.spec....
1
vote
1
answer
350
views
How to print contents of input files to kubectl kustomize command
I have a azure devops pipeline to deploy my helm chart to Kubernetes cluster.
In helm upgrade command I have specified --post-renderer which runs a script
This script runs command
kubectl kustomize ./
...
1
vote
1
answer
643
views
How to setup `kubectl krew` inside Docker Container?
I’m trying to use kubectl with krew inside a Docker container. Here’s my Dockerfile:
FROM alpine:latest
ENV KUBECTL_VERSION=v1.30.5 KREW_VERSION=v0.4.4
RUN apk update && apk add --no-cache ...
1
vote
1
answer
337
views
kubectl apply does not remove environment variables
I am trying to use kubectl apply -f dep.yml in order to remove an environment variable from an existing deployment
when I run the command, I get a confirmation message
deployment.apps/XXXX configured
...
0
votes
0
answers
226
views
is there any helm chart for self hosted Novu on kubernetes cluster?
Deploying Novu on Self-Hosted Kubernetes: Best Practices for Helm vs Manual Manifests
Currently running:
$ kubectl version
Client Version: v1.31.2
Kustomize Version: v5.4.2
Server Version: v1.27.2
# ...
-1
votes
2
answers
117
views
How to execute kubectl commands in HCP?
I have very simple use case that I am trying to run kubectl command using terraform's HCP
resource "null_resource" "meta_create_namespace_and_secret" {
provisioner "local-...
1
vote
2
answers
637
views
Is there a way to attach a PVC to an existing, running Pod in Kubernetes?
I am using the Bitnami Postgresql-HA Helm charts to run a Postgresql cluster in Kubernetes. I also have a PersistentVolumeClaim (PVC) full of data that isn't going into the database. I'd like to mount ...
1
vote
1
answer
591
views
When using kubectl behind a proxy, can I set an environment variable to provide a custom certificate authority?
I need to use kubectl behind a HTTP proxy. Kubectl gives an error "certificate signed by unknown authority". This goes away if I do kubectl --insecure-skip-tls-verify but I'd rather install ...
0
votes
1
answer
47
views
Java: ProcessBuilder with psql command, ProcessBuilder with kubectl port-forward, won't connect to the database. Same commands work on cmdline
Os: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS" psql: psql (PostgreSQL) 12.20
(Ubuntu 12.20-0ubuntu0.20.04.1) Java: openjdk version "11.0.24"
...
0
votes
0
answers
135
views
Unable to disable the readonly kubelet port in GKE
I've tried to follow this guide in accordance with the email that we have received about the unsecure readonly port exposed by kubelet.
The script I used is pasted below:
#!/bin/bash
echo Please ...
0
votes
0
answers
144
views
How to I exit the kubectl command sleep infinity and add it back to my yaml file?
my docker image gets built with the command python3 main.py so after the deployment script runs I cannot kill the process python main.py within the container. I am doing development which is heavily ...
0
votes
1
answer
610
views
calico resource mapping not found for kind "GlobalNetworkPolicy" in version "projectcalico.org/v3" [closed]
I have a kubernetes cluster with calico installed (helm chart version v3.28.0). I have already applied multiple times calico networkpolicies. All of a sudden, applying the exact same policy gives me ...
0
votes
2
answers
114
views
Excluding "kubectl get pods" RESTARTS column from command output
I'm running the following query:
$ kubectl get pods -o wide -n logging-app-global --field-selector=status.phase=Running --show-labels
NAME READY STATUS ...
0
votes
0
answers
189
views
Can we read k8 container logs using a sidecar container and without using kubectl?
Background: We are using third-party software (SASViya) that has multiple deployments, cronjob, stateful sets, and finally the pod templates which is responsible for creating new pods whenever a user ...
1
vote
1
answer
124
views
Delete Kubernetes namespace with delay
I have the following issue. We need to implement a command which deletes a Kubernetes namespace but with some delay of 1 hour. I tried with this one but it's not working:
kubectl delete ns $NAMESPACE -...
0
votes
1
answer
1k
views
kubectl error "You must be logged in to the server (the server has asked for the client to provide credentials"
I am getting error when I run any kubectl command.
$ kubectl version
Client Version: v1.29.1
error: You must be logged in to the server (the server has asked for the client to provide credentials)
I ...
0
votes
1
answer
575
views
How to remove claim from a persistent volume when it was released?
After the PVC is deleted the associated PV still shows the claim. This might be expected behavior, but for my usecase it must turn to "Available" status again. When I remove the claim object ...
-1
votes
1
answer
338
views
error when creating "mongo.yaml": Deployment in version "v1" cannot be handled as a Deployment
I wrote a mongo.yaml file for a minikube cluster. Creating the deployment brought me an error that I can't decode for now. This is just a test deployment in preparation for a web app.
I tried editing ...
0
votes
1
answer
187
views
How can I add worker node [TLS handshake timeout]?
I have a ubuntu-based master machine where I have a microk8s cluster running.
I wanted to add an rpi as a worker node. microk8s join worked and replied with
Waiting for this node to finish joining the ...
0
votes
0
answers
95
views
Kubectl ingress does not let access to the internet due to timeout error
I am trying to use ingress to make a pretty basic flask application reachable via internet.
First, I installed and enabled Ingress-Nginx
kubectl apply -f https://raw.githubusercontent.com/kubernetes/...
0
votes
2
answers
2k
views
How to debug production containers using kubectl debug under root user?
I’m facing an issue related to our strict security policies, which are configured according to best practices. Below is the security context we are using:
spec:
securityContext:
runAsUser: <...
1
vote
1
answer
106
views
How can I configure my AKS cluster to only allow kubectl commands when connected to a specific Pritunl VPN
I want that when I am connected to my (Dev6) pritunl, I should be able to run kubectl commands on my AKS cluster and otherwise, I should not be able to.
I tried adding the specific IP range of my Dev6 ...
0
votes
1
answer
42
views
Restrict login access to the container
I have a container with the base image "tomcat:9.0.87"
We are supposed to restrict the login access (kubectl exec) into the container. We are able to login to the container with shell and ...
0
votes
1
answer
150
views
minikube kubectl get pods all-namespaces - not working
I have setup a minikube on my macos.
But kubectl is not supporting all the commands.
This particular commands is not being supported
minikube kubectl get pods all-namespaces
getting the error -
Error ...
-1
votes
1
answer
50
views
Kubernetes get pods How it can manage [duplicate]
C:\Users\HP>kubectl run sample-nginx --image=nginx --replicas=2 --port=80
error: unknown flag: --replicas
See 'kubectl run --help' for usage.
How to deal with this
-1
votes
1
answer
172
views
How can i scale a deployment using an YAML file?
I don't understand about kubectl.
I'm trying to scale a pod using Cronjob in Huawei Cloud. I've resolved how to scale then using Linux Terminal and it works, but when i try to use the kubectl, it ...
-1
votes
1
answer
92
views
How to Schedule a Pod in different Node in GKE
I have cluster running in gke standard mode
Here is the details
PROD Env
GKE Standard Cluster running
with 2 Node Pool
and 9 Nodes
default-pool 1.28.3-gke.1286000 5 (1 - 2 per zone) e2-...
0
votes
1
answer
395
views
Allocated Resources percentage in "kubectl top node"
Doing a kubectl describe node I get:
[...]
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
Resource Requests Limits
-------- -------- ...
1
vote
1
answer
440
views
How do I use a Kubernetes Watcher to monitor namespace events in a cluster?
This is almost certainly a misuse/misread of the API on my end but was wondering if I could get some guidance on this:
This is my code snippet/attempt at creating a watcher to list all namespace ...
0
votes
2
answers
147
views
Is there any other way to apply deployment.yml and service.yml to deploy an application to AKS?
To deploy an application to AKS I have to:
Deploy my application to Azure Container Registry
Create Azure Kubernetes Service
Create files: service.yml and deployment.yml
Connect to AKS using commands:...
0
votes
1
answer
82
views
MultipleCompilationErrorsException in groovy while executing kubectl to find java process id from a pod
This is my line from declarative pipeline in groovy to fetch java process ID from a k8s pod:
def jpsid = "${kubectl exec -i "${pod}" -n *<some_namespace>* -- jps | awk '{ print &...
2
votes
1
answer
521
views
What are the Kubernetes RBAC verbs and resources which allow "kubectl rollout restart" a deployment?
What are the Kubernetes RBAC verbs and resources which allow kubectl rollout restart a deployment?
At this moment the current RBAC verbs are create, delete, deletecollection, get, list, patch, update, ...