Closed hectoralicea closed 3 years ago
Hi @hectoralicea,
Thanks for the detailed explanation! I’m going to try to replicate your steps and see if I reproduce the issue. I’ll keep you updated.
Hi @hectoralicea,
Thanks for the detailed explanation! I’m going to try to replicate your steps and see if I reproduce the issue. I’ll keep you updated.
Hi @pablogalegoc
Let me know how I can help. I can provide you the ansible playbook that builds this, but then again, that might be a bit too complicated, or it might be easier. I guess it depends on your environment.
Hi @hectoralicea!
I've not been able to reproduce the issue but I have the same suspicions as you, that it has something to do with the permissions set inside /bitnami/wordpress
by the init container. Could you execute:
kubectl exec [POD-ID] -- ls -l /bitnami/wordpress
Hi @hectoralicea!
I've not been able to reproduce the issue but I have the same suspicions as you, that it has something to do with the permissions set inside
/bitnami/wordpress
by the init container. Could you execute:kubectl exec [POD-ID] -- ls -l /bitnami/wordpress
ansible$ kc exec -it -n wp-bitnami bitnami-5dcc7c7d6b-4pzrg -- ls -l /bitnami/wordpress Defaulted container "wordpress" out of: wordpress, init (init) total 728 -rw-r--r--. 1 root 1001 277 Jul 14 13:29 README.md -rw-r--r--. 1 root 1001 727138 Jul 14 13:29 bitnami.sql -rw-r--r--. 1 root 1001 4398 Jul 14 13:29 wp-config.php drwxr-sr-x. 4 root 1001 4096 Jul 14 13:29 wp-content x-eps-bartbox2 [~]
I was able to get it to work. All I had to do was add the following to the initContainer
securityContext:
runAsNonRoot: true
runAsUser: 1001
runAsGroup: 1001
so the initContainer looks like this
initContainers:
- name: init
image: bitnami/git:latest
imagePullPolicy: IfNotPresent
securityContext:
runAsNonRoot: true
runAsUser: 1001
runAsGroup: 1001
env:
- name: GIT_REPO_CRED_USER
valueFrom:
secretKeyRef:
name: {{ wordpress_git_credentials }}
key: username
- name: GIT_REPO_CRED_USER_PASSWORD
valueFrom:
secretKeyRef:
name: {{ wordpress_git_credentials }}
key: password
- name: GIT_DISCOVERY_ACROSS_FILESYSTEM
value: "1"
command:
- 'sh'
- '-c'
- >
cd /bitnami/wordpress &&
pwd &&
git clone --branch {{ wordpress_site_git_repo_branch }} --verbose https://${GIT_REPO_CRED_USER}:${GIT_REPO_CRED_USER_PASSWORD}@{{ git_repo_host }}/{{ git_repo_org_owner }}/{{ git_repo_wp_sites_subgroup }}/{{ wordpress_site_git_repo }}.git . &&
ls -al &&
git status || true
volumeMounts:
- mountPath: /bitnami/wordpress
name: wordpress-data
subPath: wordpress
Happy to hear that @hectoralicea!
I'm pretty sure it was a permissions issue since the ones set on the wp-content
folder by the default installation of the chart are:
drwxrwxr-x 7 1001 root 4096 Jul 15 09:17 wp-content
Which chart: bitnami/wordpress 11.0.16
Describe the bug I'm able to install the wordpress chart quite nicely and when I use the default wordpress content, I'm able to install plugins. BUT when I try to load prior content and restore mysql data from one exported from a prior deployment, I'm not able to install plugins. I get the message: 'Update failed: Could not create directory.' on the plugin webpage.
I suspect it has something to do with using the initContainer to pull the content from the git repo.
To Reproduce Steps to reproduce the behavior:
1.) first create a configmap which has the sql dump you want to load on initialization.
note: bitnami.sql is an sql dump export file from a prior deployment which worked just fine configured with using default install. e.g. ==> Configuring WordPress with settings provided via environment variables
2.) run the helm install chart, pass the wordpress-values.yaml which is shown below. Pay special attention to these lines:
initContainers:
which I clone a git repository which has the wp content I was to substitute in to the container.Contents of wordpress-values.yaml
Expected behavior
It should work just as if I'm running using default autogenerated content and be able to install plugins.
Version of Helm and Kubernetes:
helm version
:kubectl version
:Additional context Add any other context about the problem here.