Questions tagged [kubernetes]

KUBERNETES QUESTIONS MUST BE SPECIFICALLY RELATED TO SOFTWARE DEVELOPMENT. Configuration and deployment is off-topic here. A good rule of thumb is, if it happens outside the pod, it's probably off-topic. If it's about code running inside the pod, it's probably OK.

Kubernetes is a system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications. Its APIs are intended to serve as the foundation for an open ecosystem of tools, automation systems, and higher-level API layers. Kubernetes can run on various cloud providers, on premises in VMs, or on bare metal machines.

Getting started

Books

Online Courses

57333 questions
282
votes
24 answers

Kubernetes pod gets recreated when deleted

I have started pods with command $ kubectl run busybox \ --image=busybox \ --restart=Never \ --tty \ -i \ --generator=run-pod/v1 Something went wrong, and now I can't delete this Pod. I tried using the methods described below but the Pod keeps…
yman
  • 2,931
  • 2
  • 11
  • 6
278
votes
14 answers

How can I keep a container running on Kubernetes?

I'm now trying to run a simple container with shell (/bin/bash) on a Kubernetes cluster. I thought that there was a way to keep a container running on a Docker container by using pseudo-tty and detach option (-td option on docker run command). For…
springwell
  • 2,891
  • 2
  • 11
  • 6
273
votes
34 answers

Namespace "stuck" as Terminating, How I removed it

I had a "stuck" namespace that I deleted showing in this eternal "terminating" status.
ximbal
  • 3,178
  • 2
  • 17
  • 19
269
votes
11 answers

How to switch namespace in kubernetes

Say, I have two namespaces k8s-app1 and k8s-app2 I can list all pods from specific namespace using the below command kubectl get pods -n We need to append namespace to all commands to list objects from the respective namespaces. Is…
P Ekambaram
  • 15,499
  • 7
  • 34
  • 59
263
votes
15 answers

How to switch kubectl clusters between gcloud and minikube

I have Kubernetes working well in two different environments, namely in my local environment (MacBook running minikube) and as well as on Google's Container Engine (GCE, Kubernetes on Google Cloud). I use the MacBook/local environment to develop…
Eric Broda
  • 6,701
  • 6
  • 48
  • 72
257
votes
7 answers

Service located in another namespace

I have been trying to find a way to define a service in one namespace that links to a Pod running in another namespace. I know that containers in a Pod running in namespaceA can access serviceX defined in namespaceB by referencing it in the cluster…
David McKinley
  • 2,973
  • 2
  • 12
  • 11
249
votes
23 answers

Get YAML for deployed Kubernetes services?

I am trying to deploy my app to Kubernetes running in Google Container Engine. The app can be found at: https://github.com/Industrial/docker-znc. The Dockerfile is built into an image on Google Container Registry. I have deployed the app in…
Industrial
  • 2,861
  • 2
  • 15
  • 10
248
votes
8 answers

Kubernetes how to make Deployment to update image

I do have deployment with single pod, with my custom docker image like: containers: - name: mycontainer image: myimage:latest During development I want to push new latest version and make Deployment updated. Can't find how to do that, without…
Andriy Kopachevskyy
  • 7,276
  • 10
  • 47
  • 56
238
votes
12 answers

Restart pods when configmap updates in Kubernetes?

How do I automatically restart Kubernetes pods and pods associated with deployments when their configmap is changed/updated? I know there's been talk about the ability to automatically restart pods when a config maps changes but to my knowledge…
Johan
  • 37,479
  • 32
  • 149
  • 237
235
votes
6 answers

Kubernetes API - Get Pods on Specific Nodes

Reading the Kubernets documentation it looks to be possible to select a certain range of pods based on labels. I want to select all the pods on one node but I don't want to label each pod on their corresponding node. Am I missing something from the…
Fran
  • 3,693
  • 4
  • 19
  • 19
234
votes
19 answers

How to copy files from kubernetes Pods to local system

I'm trying to copy files from Kubernetes Pods to my local system. I am getting the below error while running following command: kubectl cp aks-ssh2-6cd4948f6f-fp9tl:/home/azureuser/test.cap ./test.cap Output: tar: home/azureuser/test: Cannot…
Girish
  • 2,449
  • 3
  • 9
  • 11
234
votes
4 answers

Kubernetes: How do I delete clusters and contexts from kubectl config?

kubectl config view shows contexts and clusters corresponding to clusters that I have deleted. How can I remove those entries? The command kubectl config unset clusters appears to delete all clusters. Is there a way to selectively delete cluster…
Jeremy Lewi
  • 6,386
  • 6
  • 22
  • 37
232
votes
14 answers

kubectl logs - continuously

kubectl logs gets latest logs from my deployment - I am working on a bug and interested to know the logs at runtime - How can I get continuous stream of logs ? edit: corrected question at the end.
npr
  • 4,325
  • 4
  • 20
  • 30
225
votes
9 answers

How to tag docker image with docker-compose

I want to build image via docker-compose and set specific tag to it. Documentation says: Compose will build and tag it with a generated name, and use that image thereafter. But I can't find a way to specify tag and for built images I always see…
4ybaka
  • 2,954
  • 4
  • 16
  • 21
221
votes
14 answers

How can I debug "ImagePullBackOff"?

All of a sudden, I cannot deploy some images which could be deployed before. I got the following pod status: [root@webdev2 origin]# oc get pods NAME READY STATUS RESTARTS AGE arix-3-yjq9w 0/1 …
Devs love ZenUML
  • 11,344
  • 8
  • 53
  • 67