<p>I have <strong>Wordpress</strong> run as an <strong>app container</strong> in Google Cloud Kubernetes Cluster.
I've ruined my site a bit by wrong modifications of theme's <strong>functions.php</strong> file. So now i would like to remove my bad code to make site working. Hoever I can not find where Wordpress is located.
As all I need is to remove couple lines of PHP code I thought it might be easier to do it right from the SSH command line without playing with SFTP and keys (sorry I'm newby in WordPress/Sites in general)
This how it looks like in Google Cloud Console</p>
<p><strong>Wordpress install</strong></p>
<p><img src="https://i.stack.imgur.com/S45GC.png" alt="Wordpress App" /></p>
<p><strong>Google Cloud Console: my cluster</strong></p>
<p><img src="https://i.stack.imgur.com/dfH3M.png" alt="Google Cloud Console screenshot" /></p>
<p>I'm connecting to cluster through SSH by pressing &quot;Connect&quot; button.
And... tada! I see NO &quot;/var/www/html&quot; in &quot;var&quot; folder! &quot;.../www/html&quot; folder is not exists/visible even under root</p>
<p><img src="https://i.stack.imgur.com/L0uYN.png" alt="Contents on VAR folder" /></p>
<p>Can someone help me with finding WordPress install, please :)</p>
<p>Here is the output for <code>$ kubectl describe pod market-engine-wordpress-0 mypod -n kalm-system</code> comand</p>
<pre><code>Name:         market-engine-wordpress-0
Namespace:    kalm-system
Priority:     0
Node:         gke-cluster-1-default-pool-6c5a3d37-sx7g/10.164.0.2
Start Time:   Thu, 25 Jun 2020 17:35:54 +0300
Labels:       app.kubernetes.io/component=wordpress-webserver
              app.kubernetes.io/name=market-engine
              controller-revision-hash=market-engine-wordpress-b47df865b
              statefulset.kubernetes.io/pod-name=market-engine-wordpress-0
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.36.0.17
IPs:
  IP:           10.36.0.17
Controlled By:  StatefulSet/market-engine-wordpress
Containers:
  wordpress:
    Container ID:   docker://32ee6d8662ff29ce32a5c56384ba9548bdb54ebd7556de98cd9c401a742344d6
    Image:          gcr.io/cloud-marketplace/google/wordpress:5.3.2-20200515-193202
    Image ID:       docker-pullable://gcr.io/cloud-marketplace/google/wordpress@sha256:cb4515c3f331e0c6bcca5ec7b12d2f3f039fc5cdae32f0869abf19238d580575
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Mon, 29 Jun 2020 15:37:38 +0300
      Finished:     Mon, 29 Jun 2020 15:40:08 +0300
    Ready:          False
    Restart Count:  774

  Environment:
      POD_NAME:       market-engine-wordpress-0 (v1:metadata.name)
      POD_NAMESPACE:  kalm-system (v1:metadata.namespace)
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-4f6xq (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  market-engine-wordpress-pvc:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  market-engine-wordpress-pvc-market-engine-wordpress-0
    ReadOnly:   false
  apache-config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      market-engine-wordpress-config
    Optional:  false
  config-map:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      market-engine-wordpress-config
    Optional:  false
  default-token-4f6xq:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-4f6xq
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                       From                                               Message
  ----     ------     ----                      ----                                               -------
  Warning  Unhealthy  8m33s (x9023 over 2d15h)  kubelet, gke-cluster-1-default-pool-6c5a3d37-sx7g  Readiness probe failed: HTTP probe failed with statuscode: 500
  Warning  BackOff    3m30s (x9287 over 2d15h)  kubelet, gke-cluster-1-default-pool-6c5a3d37-sx7g  Back-off restarting failed container
</code></pre>

0LEg
<p>As you described, your application is crashing because of a change you have made in the code. This is making your website to fail and your pod is configured to check if the website is running fine and if not, the container will be restarted. The configuration that makes it happen is the LivenessProbe and the ReadinessProbe.</p>
<p>The problem here is that prevents you from fixing the problem.</p>
<p>The good news is that your data is saved under <code>/var/www/html</code> and this directory is on a external storage.</p>
<p>So, the easiest solution is to create a new pod and attach this storage to this pod. Problem is that this storage cannot be mounted on more than one container at the same time.</p>
<p>Creating this new pod, requires you to temporarily remove your wordpress pod. I know, it may be scary but we will recreate it after.</p>
<p>I reproduced your scenario and tested these steps. So Let's start. (All steps as mandatory)</p>
<p>Before we start, let's save your <code>market-engine-wordpress</code> manifest:</p>
<pre><code>$ kubectl get statefulsets market-engine-wordpress -o yaml &gt; market-engine-wordpress.yaml
</code></pre>
<p>Delete your wordpress statefulset:</p>
<pre><code>$ kubectl delete statefulsets market-engine-wordpress
</code></pre>
<p>This commands delete the instruction that creates your wordpress pod.</p>
<p>Now, let's create a new pod using the following manifest:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: fenix 
  namespace: kalm-system  
spec:
  volumes:
  - name: market-engine-wordpress-pvc
    persistentVolumeClaim:
      claimName: market-engine-wordpress-pvc-market-engine-wordpress-0    
  containers:
  - name: ubuntu
    image: ubuntu
    command: ['sh', '-c', &quot;sleep 36000&quot;]
    volumeMounts:
    - mountPath: /var/www/html
      name: market-engine-wordpress-pvc
      subPath: wp
</code></pre>
<p>To create this pod, save this content in a file as <code>fenix.yaml</code> and run the following command:</p>
<pre><code>$ kubectl apply -f fenix.yaml
</code></pre>
<p>Check if the pod is ready:</p>
<pre><code>$ kubectl get pods fenix
NAME         READY   STATUS    RESTARTS   AGE
fenix        1/1     Running   0          5m
</code></pre>
<p>From this point, you can connect to this pod and fix your <code>functions.php</code> file:</p>
<pre><code>$ kubectl exec -ti fenix -- bash
root@fenix:/# cd /var/www/html/wp-includes/
root@fenix:/var/www/html/wp-includes# 
</code></pre>
<p>When you are done fixing your code, we can delete this pod and re-create your wordpress pod.</p>
<pre><code>$ kubectl delete pod fenix 
pod &quot;fenix&quot; deleted
</code></pre>
<pre><code>$ kubectl apply -f market-engine-wordpress.yaml 
statefulset.apps/market-engine-wordpress created
</code></pre>
<p>Check if the pod is ready:</p>
<pre><code>$ kubectl get pod market-engine-wordpress-0 
NAME                        READY   STATUS    RESTARTS   AGE
market-engine-wordpress-0   2/2     Running   0          97s
</code></pre>
<p>If you need to exec into the wordpress container, your application uses the concept of multi-container pod and connecting to the right container requires you to indicate what container you want to connect.</p>
<p>To check how many containers and the name of which one you can run <code>kubectl get pod mypod -o yaml</code> or run <code>kubectl describe pod mypod</code>.</p>
<p>To finally exec into it, use the following command:</p>
<pre><code>$ kubectl exec -ti market-engine-wordpress-0 -c wordpress -- bash
root@market-engine-wordpress-0:/var/www/html# 
</code></pre>
