Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy to kubernetes issue #294

Closed
DavidCamelo opened this issue Jul 1, 2020 · 13 comments
Closed

deploy to kubernetes issue #294

DavidCamelo opened this issue Jul 1, 2020 · 13 comments
Assignees

Comments

@DavidCamelo
Copy link

DavidCamelo commented Jul 1, 2020

Hi,
I have the following configuration to deploy phpmyadmin to kubernetes.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpmyadmin
  labels:
    app: phpmyadmin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: phpmyadmin
  template:
    metadata:
      labels:
        app: phpmyadmin
    spec:
      containers:
        - name: phpmyadmin
          image: phpmyadmin/phpmyadmin:5
          ports:
            - containerPort: 80
              protocol: TCP
          env:
            - name: PMA_HOST
              value: my-mysql
            - name: PMA_PORT
              value: "3306"
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: password
            - name: PMA_USER
              value: admin
            - name: PMA_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: admin-password
          resources:
            limits:
              cpu: 50m
              memory: 32Mi
          imagePullPolicy: Always
      restartPolicy: Always
  strategy:
    type: RollingUpdate
  revisionHistoryLimit: 1

When the pod goes up it doesn't start the apache, I have to run service apache2 start after this I check the phpmyadmin and see that it doesn't take the environment variables defined to connect to the database
phpmyadmin
Could you help me with this problem? thanks in advance!

@williamdes
Copy link
Member

Hi @DavidCamelo

You need to have your instance on the same network that the database is onto to enable access via phpMyAdmin.
I hope you will find some answers in my local config: https://github.com/wdesportes/phpmyadmin-local-setup/blob/a9ac9dc281bcfa3348e4c7ad10e00ef71cbcf546/docker-compose.yml#L161 :)

@DavidCamelo
Copy link
Author

DavidCamelo commented Jul 1, 2020

Hi @williamdes

Yes, my database is on the same network, I even have wordpress deploys and java application deploys pointing to that database.

I also did a test only with docker pointing to an external database I have running on IP 54.68.2.230 and it works.
docker run --name myadmin -d -e PMA_HOST=54.68.2.230 -p 8080:80 phpmyadmin/phpmyadmin:5
phpmyadmin_docker

I tried changing my deploy file and put only the PMA_HOST variable pointing to 54.68.2.230 but it still doesn't work

apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpmyadmin
  labels:
    app: phpmyadmin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: phpmyadmin
  template:
    metadata:
      labels:
        app: phpmyadmin
    spec:
      containers:
        - name: phpmyadmin
          image: phpmyadmin/phpmyadmin:5
          ports:
            - containerPort: 80
              protocol: TCP
          env:
            - name: PMA_HOST
              value: 54.68.2.230

@williamdes
Copy link
Member

Unfortunately I did not have the chance to try out kubernetes, It will take me some free time before I can run it on my workstation

Here is another kubernetes issue, maybe fixed.: #217

Could you open a StackOverflow (or other) question to have some better and faster help and if a bug is found in your config we could fix it afterwards ?

@DavidCamelo
Copy link
Author

Sure I will try asking on StackOverflow, I'll keep you posted.

@DavidCamelo
Copy link
Author

@williamdes FYI this is my thread in StackOverflow in case you want to follow
https://stackoverflow.com/questions/62685906/deploy-phpmyadmin-to-kubernetes-issue

@thloscar
Copy link

thloscar commented Jul 28, 2020

Hello, I also have the same problem deploying phpmyadmin to a kubernetes container. The logs are pointing to the same issue as you linked here: #217.

Here are the logs from my pod, managed by Openshift (openshift's heart is 100% kubernetes):
`/docker-entrypoint.sh: line 5: /etc/phpmyadmin/config.secret.inc.php: Permission denied

touch: cannot touch '/etc/phpmyadmin/config.user.inc.php': Permission denied

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.130.17.39. Set the 'ServerName' directive globally to suppress this message

(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80

(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80

no listening sockets available, shutting down

AH00015: Unable to open logs
`
This comes when I try to specify different environment variables

@williamdes
Copy link
Member

From the output the ports do not seem to bind

@DavidCamelo
Copy link
Author

Hi @oscarloop, I was trying in different ways to make it work and I couldn't do it, so I'm using the bitnami phpmyadmin image
https://hub.docker.com/r/bitnami/phpmyadmin

apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpmyadmin
  labels:
    app: phpmyadmin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: phpmyadmin
  template:
    metadata:
      labels:
        app: phpmyadmin
    spec:
      containers:
        - name: phpmyadmin
          image: bitnami/phpmyadmin:latest
          ports:
            - containerPort: 8080
              protocol: TCP
          env:
            - name: DATABASE_HOST
              value: mysql-service

@williamdes
Copy link
Member

They seem to re-build everything https://github.com/bitnami/bitnami-docker-phpmyadmin/blob/master/5/debian-10/Dockerfile

@J0WI do you have some ideas about this issue ?

@J0WI
Copy link
Contributor

J0WI commented Jul 29, 2020

@DavidCamelo can you share the complete log output? We can only see the copying now message in #294 (comment).

@DavidCamelo
Copy link
Author

@J0WI the log only shows the following, that's it.

phpMyAdmin not found in /var/www/html - copying now...
Complete! phpMyAdmin has been successfully copied to /var/www/html

@williamdes
Copy link
Member

Hi @DavidCamelo
Can you confirm it works on Kubernetes?

@williamdes williamdes self-assigned this Oct 7, 2022
@DavidCamelo
Copy link
Author

hi @williamdes yes, It is working on Kubernetes.
This is my yml that is working

apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpmyadmin
  labels:
    app: phpmyadmin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: phpmyadmin
  template:
    metadata:
      labels:
        app: phpmyadmin
    spec:
      containers:
        - name: phpmyadmin
          image: phpmyadmin:latest
          ports:
            - name: phpmyadmin
              containerPort: 80
              protocol: TCP
          env:
            - name: PMA_HOST
              value: wordpress-mysql
          imagePullPolicy: Always
      restartPolicy: Always

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants