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
218
votes
20 answers

Sharing secret across namespaces

Is there a way to share secrets across namespaces in Kubernetes? My use case is: I have the same private registry for all my namespaces and I want to avoid creating the same secret for each.
matth3o
  • 3,229
  • 3
  • 20
  • 24
217
votes
9 answers

Multiple environments (Staging, QA, production, etc) with Kubernetes

What is considered a good practice with K8S for managing multiple environments (QA, Staging, Production, Dev, etc)? As an example, say that a team is working on a product which requires deploying a few APIs, along with a front-end application.…
Yoanis Gil
  • 3,022
  • 2
  • 15
  • 22
214
votes
21 answers

My kubernetes pods keep crashing with "CrashLoopBackOff" but I can't find any log

This is what I keep getting: [root@centos-master ~]# kubectl get pods NAME READY STATUS RESTARTS AGE nfs-server-h6nw8 1/1 Running 0 1h nfs-web-07rxz 0/1 CrashLoopBackOff 8 …
Lucifer
  • 2,231
  • 3
  • 11
  • 8
210
votes
6 answers

How kubectl port-forward works?

kubectl exposes commands that can be used to create a Service for an application and assigns an IP address to access it from internet. As far as I understand, to access any application within Kubernetes cluster there should be a Service resource…
karthikeayan
  • 4,291
  • 7
  • 37
  • 75
210
votes
10 answers

How to set multiple commands in one yaml file with Kubernetes?

In this official document, it can run command in a yaml config file: https://kubernetes.io/docs/tasks/configure-pod-container/ apiVersion: v1 kind: Pod metadata: name: hello-world spec: # specification of the pod’s contents restartPolicy:…
scho
  • 3,275
  • 6
  • 19
  • 30
206
votes
6 answers

What's the best way to share/mount one file into a pod?

I was considering using secrets to mount a single file but it seems that you can only mount directory that will overwrites all the other content. How can I share a single config file without mounting a directory?
Smana
  • 2,331
  • 2
  • 14
  • 10
204
votes
8 answers

How to delete all resources from Kubernetes one time?

Include: Daemon Sets Deployments Jobs Pods Replica Sets Replication Controllers Stateful Sets Services ... If has replicationcontroller, when delete some deployments they will regenerate. Is there a way to make kubenetes back to initialize status?
online
  • 4,919
  • 10
  • 32
  • 47
201
votes
15 answers

Restart container within pod

I have a pod test-1495806908-xn5jn with 2 containers. I'd like to restart one of them called container-test. Is it possible to restart a single container within a pod and how? If not, how do I restart the pod? The pod was created using a…
s5s
  • 11,159
  • 21
  • 74
  • 121
199
votes
7 answers

Kubernetes Deployments vs StatefulSets

I've been doing a lot of digging on Kubernetes, and I'm liking what I see a lot! One thing I've been unable to get a clear idea about is what the exact distinctions are between the Deployment and StatefulSet resources and in which scenarios would…
SS781
  • 2,507
  • 2
  • 14
  • 17
194
votes
3 answers

What is a headless service, what does it do/accomplish, and what are some legitimate use cases for it?

I've read a couple of passages from some books written on Kubernetes as well as the page on headless services in the docs. But I'm still unsure what it really actually does and why someone would use it. Does anyone have a good understanding of it,…
John Lexus
  • 3,576
  • 3
  • 15
  • 33
192
votes
19 answers

Checking Kubernetes pod CPU and memory utilization

I am trying to see how much memory and CPU is utilized by a kubernetes pod. I ran the following command for this: kubectl top pod podname --namespace=default I am getting the following error: W0205 15:14:47.248366 2767 top_pod.go:190] Metrics…
aniztar
  • 2,443
  • 4
  • 18
  • 24
190
votes
14 answers

How to sign in kubernetes dashboard?

I just upgraded kubeadm and kubelet to v1.8.0. And install the dashboard following the official document. $ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml After that,…
ichbinblau
  • 4,507
  • 5
  • 23
  • 36
177
votes
19 answers

Decoding Kubernetes secret

I inherited a Kubernetes/Docker setup, and I accidentally crashed the pod by changing something relating to the DB password. I am trying to troubleshoot this. I don't have much Kubernetes or Docker experience, so I'm still learning how to do…
Steven Matthews
  • 9,705
  • 45
  • 126
  • 232
176
votes
9 answers

How can I update a secret on Kubernetes when it is generated from a file?

I've created a secret using kubectl create secret generic production-tls \ --from-file=./tls.key \ --from-file=./tls.crt If I'd like to update the values - how can I do this?
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
176
votes
15 answers

How do you cleanly list all the containers in a kubernetes pod?

I am looking to list all the containers in a pod in a script that gather's logs after running a test. kubectl describe pods -l k8s-app=kube-dns returns a lot of info, but I am just looking for a return like: etcd kube2sky skydns I don't see a…
Charles L.
  • 5,795
  • 10
  • 40
  • 60