geerlingguy / raspberry-pi-dramble

DEPRECATED - Raspberry Pi Kubernetes cluster that runs HA/HP Drupal 8
http://www.pidramble.com/
MIT License
1.67k stars 260 forks source link

Can't run `kubectl exec` or `kubectl logs` - getting NotFound error #138

Closed geerlingguy closed 5 years ago

geerlingguy commented 5 years ago

For example:

$ kubectl get pods -n drupal8
NAME                      READY   STATUS    RESTARTS   AGE
drupal8-f446ddc7b-2fjrb   1/1     Running   0          5m5s
drupal8-f446ddc7b-zfsrf   1/1     Running   0          5m5s
mysql-5b59fd46f4-wmmrt    1/1     Running   0          5m28s
$ kubectl logs drupal8-f446ddc7b-2fjrb -n drupal8
Error from server (NotFound): the server could not find the requested resource ( pods/log drupal8-f446ddc7b-2fjrb)

This is definitely happening in the Vagrant environment, but not sure yet about the Dramble (Pi) environment. I haven't run the playbook in that environment for a couple days.

If it's just Vagrant, it's likely related to the network interfaces, and it's trying to route a request over an internal network which can't see the other nodes.

geerlingguy commented 5 years ago

The reason I'm bumping into this is because, now that I have Drupal running with a base set of 2 replicas, the installer (install.php) seems to error out whenever I try running it via the UI.

So I'm trying to get one of the Drupal pods, then run kubectl exec against it to do a drush site-install.

geerlingguy commented 5 years ago

This helped: https://github.com/geerlingguy/ansible-role-kubernetes/commit/dcea1bfe57538a309f46c6bddb9b3a09fa881112

For Vagrant I had:

kubernetes_kubelet_extra_args: '--node-ip={{ inventory_hostname }}'

But since I updated the inventory layout, it now needs to be:

kubernetes_kubelet_extra_args: '--node-ip={{ ansible_host }}'

Testing the fix locally.

geerlingguy commented 5 years ago

Gah, that works... but now I'm hitting some other frustrating things once in the Drupal pod, like:

root@drupal8-f446ddc7b-2d64s:/var/www/html# vendor/bin/drush site-install standard --db-url='mysql://drupal:$DRUPAL_DB_PASSWORD@$DRUPAL_DB_HOST/drupal' --site-name='Pi Dramble'   

 You are about to CREATE the 'drupal' database. Do you want to continue? (yes/no) [yes]:
 > yes

In SiteInstallCommands.php line 354:

  Failed to create database: sh: 1: mysql: not found  

Apparently I don't have mysql-client in the geerlingguy/drupal base image.

geerlingguy commented 5 years ago

Opened upstream issue: https://github.com/geerlingguy/drupal-container/issues/9