Questions tagged [kubernetes]
Kubernetes is an open source orchestration system for Docker containers. It handles scheduling onto nodes in a compute cluster and actively manages workloads to ensure that their state matches the users declared intentions. Using the concepts of "labels" and "pods", it groups the containers which make up an application into logical units for easy management and discovery.
2,737
questions
262
votes
5
answers
317k
views
Kubernetes stuck on ContainerCreating
A pod in my Kubernetes cluster is stuck on "ContainerCreating" after running a create. How do I see logs for this operation in order to diagnose why it is stuck? kubectl logs doesn't seem to work ...
124
votes
8
answers
155k
views
Is it possible to rerun kubernetes job?
I have the following Kubernetes Job configuration:
---
apiVersion: batch/v1
kind: Job
metadata:
name: dbload
creationTimestamp:
spec:
template:
metadata:
name: dbload
spec:
...
75
votes
4
answers
68k
views
Why disable swap on kubernetes
Since Kubernetes 1.8, it seems I need to disable swap on my nodes (or set --fail-swap-on to false).
I cannot find the technical reason why Kubernetes insists on the swap being disabled. Is this for ...
68
votes
5
answers
127k
views
How do I tell when/if/why a container in a kubernetes cluster restarts?
I have a single node kubernetes cluster in google container engine to play around with.
Twice now, a small personal website I host in it has gone offline for a couple minutes. When I view the logs ...
38
votes
6
answers
58k
views
How to increase disk size in a stateful set
I'm managing an Elasticsearch deployment in Kubernetes. I see that the disk storage is getting close to full, so I would like to increase the size of the persistent volumes.
I want to change this ...
37
votes
16
answers
172k
views
kubectl get nodes error: You must be logged in to the server (Unauthorized) - how to fix
Without changes in infrastructure If I execute any kubectl command, ie:
kubectl get nodes
I get the error
You must be logged in to the server (Unauthorized)
The kubernetes cluster was opperating ok ...
33
votes
7
answers
35k
views
rsync files to a kubernetes pod
I need to rsync a file tree to a specific pod in a kubernetes cluster. It seems it should be possible if only one can convince rsync that kubectl acts sort of like rsh. Something like:
rsync --rsh='...
32
votes
8
answers
103k
views
Kubernetes always gives 503 Service Temporarily Unavailable with multiple TLS Ingress
I have a kubernetes cluster setup by kops on Amazon Web Services
I have a 2 sites setup. One is secured via SSL/TLS/https and the other is just http. Both are Wordpress sites. Domains changed to ...
32
votes
2
answers
19k
views
What is spec - selector - matchLabels used for while creating a deployment?
From Kubernetes documentation:
The selector field defines how the Deployment finds which Pods to
manage.
But, when creating deployment, I already specify the pod template as part of the ...
30
votes
3
answers
96k
views
How to mount volume with specific UID in Kubernetes Pod?
So, I'm trying to get Nexus running based off of this image in Kubernetes, but it's failing with:
mkdir: cannot create directory '../sonatype-work/nexus3/log': Permission denied
mkdir: cannot create ...
28
votes
5
answers
9k
views
Expose port 80 and 443 on Google Container Engine without load balancer
Currently I'm working on a small hobby project which I'll make open source once it's ready. This service is running on Google Container Engine.
I chose GCE to avoid configuration hassle, the costs are ...
25
votes
5
answers
19k
views
Is microk8s suitable for production environments, or is it just for development?
microk8s appears to be an easy way to install Kubernetes on Ubuntu. Several places refer to it as an alternative to minikube, which is not aimed at production environments, and this post seems to ...
24
votes
3
answers
88k
views
How could I find the Kubernetes Pod restart reasons
In have scaled my Pods to 20 in my cluster and when I see the next day the few of the scaled Pods were recreated.
When I say Pod recreated, it is getting deleted and created freshly and the timestamp ...
23
votes
4
answers
34k
views
Using environment variables in Kubernetes deployment spec
I currently use a Kubernetes spec Deployment.yaml for deploying a service. The spec includes a verbatim reference to a specific IP address (marked as <static-ip-address> below):
spec:
type: ...
23
votes
4
answers
30k
views
kubernetes dns resolver in nginx
I was developing locally in docker-compose, and had an nginx container doing a simple proxy_pass like so:
location /app/ {
proxy_pass http://webapp:3000/;
proxy_http_version 1.1;
...
20
votes
10
answers
44k
views
failed to run Kubelet: validate service connection: CRI v1 runtime API is not implemented for endpoint
I have installed kubelet 1.26.0 on Ubuntu 22.04 using apt install kubelet command, but when I try journalctl -xeu kubelet I get the following result:
░░
░░ The unit kubelet.service has entered the '...
19
votes
1
answer
91k
views
Back-off restarting failed container - Error syncing pod in Minikube
I'm facing this error when trying to create pods. It is occurring with even very common images like Ubuntu,Alpine also. I'm fairly new to Kubernetes and using a Minikube Node ( version v0.24.1 )
...
19
votes
5
answers
83k
views
How do i view logs for my Kubernetes Ingress Controller?
I have recently started to learn about Kubernetes and i'm trying understand why my ingress controller is giving a 502 error.
i'm working with google cloud platform. i can see my service of type: ...
18
votes
3
answers
24k
views
How to choose the external IP address of a Kubernetes load balancer in Google Kubernetes Engine
I'm deploying a web app using Google Kubernetes Engine and I want to make it accessible via a load balancer on an existing static IP address that I control as part of the same project in Google Cloud ...
17
votes
5
answers
57k
views
How to find the service principal assigned to a newly created AKS cluster?
I have just created an AKS cluster using a standard az aks create ... --ssh-key-value ....
According to https://docs.microsoft.com/en-us/azure/aks/kubernetes-service-principal,
an AKS cluster is ...
15
votes
3
answers
49k
views
Kubernetes nginx ingress: How to redirect foo.example.org to example.org?
My ingress currently looks like this:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-...
15
votes
6
answers
19k
views
How to list all containers in Kubernetes?
How do i list all containers in Kubernetes cluster using kubectl?
Current documentation doesn't mention anything like 'container' resource.
kubectl get pod -o json
lists all pods which contains ...
15
votes
2
answers
50k
views
How to rewrite url to backend while preserving browser url in nginx ingress?
I'm trying to rewrite the path to the service while preserving the browser url with nginx ingress on kubernetes.
What I need is this:
http://example.com/path => http://service
http://example.com/...
14
votes
4
answers
7k
views
Error creating GCE load balancer: requested address ip is neither static nor assigned to LB
I have a situation where Kubernetes apparently can no longer assign an external IP address to a service upon kubectl create -f Deployment.yaml. kubectl describe service <my-service> reports the ...
14
votes
1
answer
7k
views
Kubernetes v1.24.3 upgrade broke ingress-nginx
After upgrading our AKS kubernetes cluster to from v1.23.8 to v1.24.3 our ingress stopped working properly. No errors logged in events and the ingress-nginx pod does not report any errors on the ...
14
votes
2
answers
4k
views
Kubernetes - can I avoid using the GCE Load Balancer to reduce cost?
I'm deploying a Kubernetes cluster on GCE using Gitlab-CI. I'd like to keep the cost to a minimum - here's my current setup:
Nodes run on 3 f1-micro instances
A system pod running Traefik configured ...
14
votes
1
answer
5k
views
Enable VPC-native (alias IP) on an existing GKE cluster
Is there a way to enable Alias IP on existing GKE cluster (with disabled Alias IP)?
(Besides using https://github.com/bowei/k8s-custom-iptables to create NATs on each node)
13
votes
1
answer
2k
views
Graceful shutdown of Kubernetes cluster
We have a 4 node Kubernetes cluster, installed using Juju 2.0 and the official canonical Kubernetes charm. The sole purpose of this very local and private installation is development and testing.
One ...
12
votes
4
answers
33k
views
How do I check the max pod capacity of a Kubernetes node
I am busy setting up new k8s cluster.
I am using rke with the --max-pods: 200
kubelet: # https://rancher.com/docs/rke/latest/en/config-options/services/services-extras/#extra-args
extra_args:
...
12
votes
3
answers
5k
views
HorizontalPodAutoscaling on Amazon EKS
When trying to setup a HorizontalPodAutoscaler on Amazon EKS, the TARGETS column always displays <unknown>/50% and when describing the HPA, I see
Warning FailedGetResourceMetric 17s (x50 ...
11
votes
2
answers
36k
views
Can host aliases be assigned to deployments in Kubernetes? If so, how?
This article describes how to assign host aliases to pods in kubernetes, is there anyway to do it for a deployment and not for a pod as such?
Any other suggestions to add host entries in kubernetes ...
11
votes
2
answers
18k
views
Is there a regex function for kubernetes helm templates available?
I'm trying to implement an ingress helm template encoding the current application version into the url. This shall allow users to do soft migration by providing them different versions of the ...
11
votes
1
answer
8k
views
minikube/k8s/kubectl "failed to watch file [ ... ]: no space left on device"
I'm fairly new to k8s and minikube, and could use help understanding the frequent-but-not-ubiquitous error I get when running kubectl logs -f <POD NAME>
I get this, sometimes, and ...
11
votes
1
answer
6k
views
Can a Kubernetes pod span nodes?
The Docs say...
A pod (as in a pod of whales or pea pod) is a group of one or more containers (such as Docker containers), the shared storage for those containers, and options about how to run the ...
11
votes
3
answers
36k
views
How do I give a docker container its own routable IP on the original network?
Main question
Imagine this scenario.
A network of 192.168.0.0/24.
A computer with hostname 'Docker-Host' is running a docker engine at
192.168.0.2
'Docker-Host' has sshd server running
On 'Docker-...
10
votes
2
answers
28k
views
Kubernetes pod /etc/resolv.conf has the wrong nameserver
I have a 4-node cluster setup at home that I am playing with, and ran into a problem when I started trying to do pod-to-pod communications. I used Kubespray to install the nodes (1 "server/controller"...
9
votes
4
answers
8k
views
kube-proxy won't start in Minikube because of permission denied issue with /proc/sys/net/netfilter/nf_conntrack_max
After updating Arch Linux (sudo pacman -Syu) and restarting the system, Minikube fails to start because of kube-proxy. The logs show it was trying to modify /proc/sys/net/netfilter/nf_conntrack_max ...
9
votes
5
answers
30k
views
kubectl cannot authenticate with AWS EKS
I cannot get kubectl to authenticate with the EKS Kubernetes instance my coworker created. I've followed the documentation: the AWS CLI can run aws eks commands (I'm an AWS Full Administrator), and ...
9
votes
2
answers
18k
views
Kubernetes: relation between Service IP's and pod IP's
I'm trying to understand a bit more about Kubernetes networking. That's why I've deployed a cluster in google cloud and checked the networking:
gcloud container clusters describe cluster0 | grep -i ...
9
votes
1
answer
3k
views
NGINX vs. GCE Kubernetes ingress classes
When setting up a Kubernetes ingress on Google Container Engine, you can choose the ingress class (gce or nginx). I realize that the GCE class provisions a load balancer on Google's Cloud Platform, ...
9
votes
1
answer
17k
views
Amazon EKS: how to configure S3 access for worker nodes?
How can I configure an EKS cluster to automatically allow S3 access from worker nodes?
I've set up an EKS cluster following the Getting Started guide and have run the example Guest Book app. Now I ...
9
votes
1
answer
9k
views
Detecting Kubernetes OOMKilled Events in GKE Logs
I'd like to set up instrumentation for OOMKilled events, which look like this when examining a pod:
Name: pnovotnak-manhole-123456789-82l2h
Namespace: test
Node: test-cluster-cja8smaK-oQSR/10.x....
9
votes
1
answer
14k
views
How to find out PID of the container using crictl
Kubernetes is deprecating Docker as CRI engine. Now there is containerd and CRI-O, which can be used as an alternative to it. Both can be managed via crictl from cri-tools.
I need some common way to ...
9
votes
1
answer
1k
views
Tailing logs with GCE and stackdriver
I have a running Kubernetes cluster that aggregates it's logfiles in stackdriver and would like to tail the aggregated logs on the command line. But so far I am only able to view the json stream float ...
8
votes
1
answer
8k
views
Worker Group VS Node Group EKS
I am trying to use https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/12.2.0(Terraform AWS EKS provider)
What is the difference between worker nodes and node group?
8
votes
2
answers
23k
views
Pod keeps restarting and is in a CrashLoopBackOff state
One of our pods won't start and is constantly restarting and is in a CrashLoopBackOff state:
NAME READY STATUS RESTARTS AGE
...
8
votes
1
answer
17k
views
Kubernetes deployment "failed to pull image" with local registry, minikube
I'm getting a "Failed to pull image" error on my deployment in minikube with a local registry, despite other deployments using the same image registry working as expected.
My workflow is to build ...
8
votes
3
answers
12k
views
Kubernetes - how to map docker run command-line parameters to kubectl command line
I need to run this Docker command in Kubernetes:
docker run -p 8080:8080 sagemath/sagemath sage -notebook
I can map everything across except "-notebook" - does anyone know how to do that?
Here is ...
8
votes
1
answer
8k
views
What is the difference between objects project and namespace in Openshift 4.x
In openshift 4.x, you have an API for project which seems to be totally similar to namespace in the sense that when you create a project there a namespace created and the other way around.
I know ...
8
votes
2
answers
13k
views
How to setup Mosquitto MQTT Broker in Kubernetes
I have been trying to set up ChirpStack in a Kubernetes space, but it doesn't seem to be working for me, and I can't find any resources online that have been the solution.
**chirpstack-application-...