Score:0

Kubernetes apache pod keeps restarting

gq flag

So I'm really new to kubernetes and I'm having this problem where the pods keep restarting. I've googled around a bit but not coming up with much help. All I have is a simple apache deployment, nothing fancy.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: website-deployment
  labels:
    app: website
spec:
  replicas: 2
  selector:
    matchLabels:
      app: website
  template:
    metadata:
      labels:
        app: website
    spec:
      containers:
      - name: apache
        image: httpd:2.4.57
        ports:
        - containerPort: 80

Here is the log from the pod

root@kubemaster:~# kubectl logs website-deployment-cc57f5644-2kg7v -p
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.240.0.110. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.240.0.110. Set the 'ServerName' directive globally to suppress this message
[Mon Apr 10 19:16:24.132794 2023] [mpm_event:notice] [pid 1:tid 140595614588224] AH00489: Apache/2.4.57 (Unix) configured -- resuming normal operations
[Mon Apr 10 19:16:24.133016 2023] [core:notice] [pid 1:tid 140595614588224] AH00094: Command line: 'httpd -D FOREGROUND'
[Mon Apr 10 19:22:42.890545 2023] [mpm_event:notice] [pid 1:tid 140595614588224] AH00492: caught SIGWINCH, shutting down gracefully

As you can see it runs for a few minutes before getting a SIGWINCH event and this triggers the pod to go into CrashLoopBackOff before starting back up again. This then keeps happening in a loop.

I'm using Ubuntu 22.04 for the master and I have 2 Ubuntu 22.04 for the nodes.

Thanks

in flag
Hi Ashley welcome to S.F. It looks, based solely upon that pasted snippet, that you are trying to run Apache without any configuration whatsoever, which is a fine reason why it doesn't produce any meaningful logs and cheerfully just dies. Also, running `:latest` is a great way to generate bugs, since we have no idea what version of the container you're running. Try picking one of [the known versions](https://hub.docker.com/_/httpd/tags) so at least everyone is operating with the same mental model. Good luck
Ashley avatar
gq flag
I've changed the config to use version "2.4.57" this results in the same behaviour. I understand I've not done any configuration of apache myself but surely out of the box it should work fine
in flag
Well, that's why I said based solely upon the pasted snippet. If you run `docker run -p 80:80 httpd:2.4.57` locally, what behavior do you get?
Ashley avatar
gq flag
Running using docker manually works perfect, no issues. Just a side note I've noticed that the kube-flannel and kube-proxy pods keep restarting also. Not sure if it's related
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.