<p>I'm trying to deploy a multi-container docker app (<a href="https://github.com/shadowHawkeye/eramba" rel="nofollow noreferrer">https://github.com/shadowHawkeye/eramba</a>). This is the yaml file I'm using to <code>kubectl apply -f</code></p>
<p>The two images I have (one for DB and one for app) are built <code>docker build -t &lt;&gt; .</code> from the GitHub repo.</p>
<p>The DB_ENV_MYSQL_HOST, I've tried both  and &lt;eramba-db.eramba-1&gt;</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: eramba
  namespace: eramba-1
  labels:
   app: eramba               
spec:
  replicas: 1
  selector:
    matchLabels:
      app: eramba
  template:
    metadata:
      labels:
        app: eramba
    spec:
      containers:
      - name: eramba
        image: docker.io/deveramba/eramba:latest
        ports:
        - containerPort: 80
        env:
        - name: DB_ENV_MYSQL_DATABASE
          value: &quot;eramba-db&quot;
        - name: DB_ENV_MYSQL_HOST
          value: &quot;eramba-host&quot;
        - name: DB_ENV_MYSQL_USER
          value: &quot;eramba&quot;
        - name: DB_ENV_MYSQL_PASSWORD
          value: &quot;password&quot;
        - name: DB_ENV_MYSQL_ROOT_PASSWORD
          value: &quot;password&quot;
        - name: ERAMBA_HOSTNAME
          value: localhost
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: eramba-db
  namespace: eramba-1
  labels:
   app: eramba-db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: eramba-db
  template:
    metadata:
      labels:
        app: eramba-db
    spec:
      containers:
      - name: eramba-db
        image: docker.io/deveramba/eramba-db:latest
        ports:
        - containerPort: 3306
        env:
        - name: MYSQL_DATABASE
          value: &quot;eramba-db&quot;
        - name: MYSQL_USER
          value: &quot;eramba&quot;
        - name: MYSQL_PASSWORD
          value: &quot;password&quot;
        - name: MYSQL_ROOT_PASSWORD
          value: &quot;password&quot;
---
apiVersion: v1
kind: Service
metadata:
  name: db
  namespace: eramba-1
spec:
  selector:
    app: eramba-db
  ports:
    - name: sql
      port: 3306
      targetPort: 3306
---
apiVersion: v1
kind: Service
metadata:
  name: eramba-np
  namespace: eramba-1
spec:
  type: NodePort
  selector:
    app: eramba
  ports:
    - name: http
      port: 80
      targetPort: 80
      nodePort: 30045
</code></pre>
<p>The deployment looks like (pods and services output)</p>
<pre><code>root@osboxes:/home/osboxes/manifests# kubectl get pods -n eramba-1
NAME                         READY   STATUS    RESTARTS      AGE
eramba-7f7c88c9d6-zqnzr      1/1     Running   2 (73s ago)   7m47s
eramba-db-6c5fdfb7b8-wtgqd   1/1     Running   0             7m47s

root@osboxes:/home/osboxes/manifests# kubectl get service -o wide -n eramba-1
NAME        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE     SELECTOR
db          ClusterIP   10.98.169.229   &lt;none&gt;        3306/TCP       3h31m   app=eramba-db
eramba-np   NodePort    10.97.149.116   &lt;none&gt;        80:30045/TCP   3h31m   app=eramba
</code></pre>
<p>The problem is that kubectl logs &lt;&gt; is complaining unknown host Eramba-host. I've defined DB_ENV_MYSQL_HOST and MYSQL_HOST in both app and db deployments, respectively.</p>
<pre><code>root@osboxes:/home/osboxes/manifests# kubectl logs eramba-7f7c88c9d6-zqnzr -n eramba-1
[i] pre-exec.d - processing /scripts/pre-exec.d/010-apache.sh
tail: can't open '/var/log/apache2/*log': No such file or directory
[i] pre-exec.d - processing /scripts/pre-exec.d/020-eramba-initdb.sh
[i] Waiting for database to setup...
[i] Trying to connect to database: try 1...
ERROR 2005 (HY000): Unknown MySQL server host 'eramba-host' (-3)
[i] Trying to connect to database: try 2...
ERROR 2005 (HY000): Unknown MySQL server host 'eramba-host' (-3)
[i] Trying to connect to database: try 3...
ERROR 2005 (HY000): Unknown MySQL server host 'eramba-host' (-3)
[i] Trying to connect to database: try 4...
ERROR 2005 (HY000): Unknown MySQL server host 'eramba-host' (-3)
[i] Trying to connect to database: try 5...
ERROR 2005 (HY000): Unknown MySQL server host 'eramba-host' (-3)
[i] Trying to connect to database: try 6...
ERROR 2005 (HY000): Unknown MySQL server host 'eramba-host' (-3)
[i] Trying to connect to database: try 7...
ERROR 2005 (HY000): Unknown MySQL server host 'eramba-host' (-3)
</code></pre>
<p>Here's the <code>kubectl logs</code> output for the db</p>
<pre><code>root@osboxes:/home/osboxes/manifests# kubectl logs eramba-db-6c5fdfb7b8-wtgqd -n eramba-1
2022-01-07 19:17:00+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.5+maria~focal started.
2022-01-07 19:17:00+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-01-07 19:17:00+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.5+maria~focal started.
2022-01-07 19:17:00+00:00 [Note] [Entrypoint]: Initializing database files
2022-01-07 19:17:00 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.


PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following command:

'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at https://mariadb.com/kb or the
MySQL manual for more instructions.

Please report any problems at https://mariadb.org/jira

The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

2022-01-07 19:17:01+00:00 [Note] [Entrypoint]: Database files initialized
2022-01-07 19:17:01+00:00 [Note] [Entrypoint]: Starting temporary server
2022-01-07 19:17:01+00:00 [Note] [Entrypoint]: Waiting for server startup
2022-01-07 19:17:01 0 [Note] mariadbd (server 10.6.5-MariaDB-1:10.6.5+maria~focal) starting as process 96 ...
2022-01-07 19:17:01 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-01-07 19:17:01 0 [Note] InnoDB: Number of pools: 1
2022-01-07 19:17:01 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-01-07 19:17:01 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-01-07 19:17:01 0 [Note] InnoDB: Using Linux native AIO
2022-01-07 19:17:01 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2022-01-07 19:17:01 0 [Note] InnoDB: Completed initialization of buffer pool
2022-01-07 19:17:01 0 [Note] InnoDB: 128 rollback segments are active.
2022-01-07 19:17:01 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-01-07 19:17:01 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-01-07 19:17:01 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-01-07 19:17:01 0 [Note] InnoDB: 10.6.5 started; log sequence number 41361; transaction id 14
2022-01-07 19:17:01 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-01-07 19:17:01 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-01-07 19:17:01 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2022-01-07 19:17:01 0 [Warning] 'user' entry 'root@eramba-db-6c5fdfb7b8-wtgqd' ignored in --skip-name-resolve mode.
2022-01-07 19:17:01 0 [Warning] 'proxies_priv' entry '@% root@eramba-db-6c5fdfb7b8-wtgqd' ignored in --skip-name-resolve mode.
2022-01-07 19:17:01 0 [Note] InnoDB: Buffer pool(s) load completed at 220107 19:17:01
2022-01-07 19:17:01 0 [Note] mariadbd: ready for connections.
Version: '10.6.5-MariaDB-1:10.6.5+maria~focal'  socket: '/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
2022-01-07 19:17:02+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
2022-01-07 19:17:03 5 [Warning] 'proxies_priv' entry '@% root@eramba-db-6c5fdfb7b8-wtgqd' ignored in --skip-name-resolve mode.
2022-01-07 19:17:03+00:00 [Note] [Entrypoint]: Creating database eramba-db
2022-01-07 19:17:03+00:00 [Note] [Entrypoint]: Creating user eramba
2022-01-07 19:17:03+00:00 [Note] [Entrypoint]: Giving user eramba access to schema eramba-db

2022-01-07 19:17:03+00:00 [Note] [Entrypoint]: Stopping temporary server
2022-01-07 19:17:03 0 [Note] mariadbd (initiated by: root[root] @ localhost []): Normal shutdown
2022-01-07 19:17:03 0 [Note] InnoDB: FTS optimize thread exiting.
2022-01-07 19:17:03 0 [Note] InnoDB: Starting shutdown...
2022-01-07 19:17:03 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2022-01-07 19:17:03 0 [Note] InnoDB: Buffer pool(s) dump completed at 220107 19:17:03
2022-01-07 19:17:04 0 [Note] InnoDB: Removed temporary tablespace data file: &quot;./ibtmp1&quot;
2022-01-07 19:17:04 0 [Note] InnoDB: Shutdown completed; log sequence number 42335; transaction id 15
2022-01-07 19:17:04 0 [Note] mariadbd: Shutdown complete

2022-01-07 19:17:04+00:00 [Note] [Entrypoint]: Temporary server stopped

2022-01-07 19:17:04+00:00 [Note] [Entrypoint]: MariaDB init process done. Ready for start up.

2022-01-07 19:17:04 0 [Note] mariadbd (server 10.6.5-MariaDB-1:10.6.5+maria~focal) starting as process 1 ...
2022-01-07 19:17:04 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-01-07 19:17:04 0 [Note] InnoDB: Number of pools: 1
2022-01-07 19:17:04 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-01-07 19:17:04 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-01-07 19:17:05 0 [Note] InnoDB: Using Linux native AIO
2022-01-07 19:17:05 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2022-01-07 19:17:05 0 [Note] InnoDB: Completed initialization of buffer pool
2022-01-07 19:17:05 0 [Note] InnoDB: 128 rollback segments are active.
2022-01-07 19:17:05 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-01-07 19:17:05 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-01-07 19:17:05 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-01-07 19:17:05 0 [Note] InnoDB: 10.6.5 started; log sequence number 42335; transaction id 14
2022-01-07 19:17:05 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-01-07 19:17:05 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-01-07 19:17:05 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2022-01-07 19:17:05 0 [Note] InnoDB: Buffer pool(s) load completed at 220107 19:17:05
2022-01-07 19:17:05 0 [Note] Server socket created on IP: '0.0.0.0'.
2022-01-07 19:17:05 0 [Note] Server socket created on IP: '::'.
2022-01-07 19:17:05 0 [Warning] 'proxies_priv' entry '@% root@eramba-db-6c5fdfb7b8-wtgqd' ignored in --skip-name-resolve mode.
2022-01-07 19:17:05 0 [Note] mariadbd: ready for connections.
Version: '10.6.5-MariaDB-1:10.6.5+maria~focal'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
</code></pre>

Bryan
<p>Here's how you can run Eramba community edition on K8s:</p>
<ul>
<li>Base on <a href="https://github.com/markz0r/eramba-community-docker" rel="nofollow noreferrer">eramba-community-docker</a>. Lots of hardwork by this author, do give the repo a star.</li>
<li>Tested on Linux only.</li>
<li>The MariaDB store data at your host path /tmp/erambadb. You can upgrade it to other storage media as you like.</li>
<li>Address implementation pertain to K8s only. Does not address any eramba specific topic or working.</li>
<li>Run in &quot;default&quot; namespace.</li>
<li>Run eramba web application as Pod. You can upgrade it to Deployment as you like.</li>
</ul>
<p>First, use your favorite editor to start a <code>eramba-cm.yaml</code> file:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: eramba
data:
  c2.8.1.sql: |
    CREATE DATABASE IF NOT EXISTS erambadb;
    USE erambadb;
    ## IMPORTANT: MUST BE INDENT 2 SPACES AFTER c2.8.1.sql ##
    &lt;copy &amp; paste content from here: https://raw.githubusercontent.com/markz0r/eramba-community-docker/master/sql/c2.8.1.sql&gt;
</code></pre>
<p><code>kubectl create -f eramba-cm.yaml</code></p>
<p>Create the storage for MariaDB:</p>
<pre><code>cat &lt;&lt; EOF &gt; eramba-storage.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: eramba-storage
spec:
  storageClassName: eramba-storage
  capacity:
    storage: 5Gi
  accessModes: 
  - ReadWriteOnce
  hostPath:
    path: /tmp/erambadb
    type: DirectoryOrCreate
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: eramba-storage
spec:
  storageClassName: eramba-storage
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
...
EOF
</code></pre>
<p><code>kubectl create -f eramba-storage.yaml</code></p>
<p>Install bitnami/mariadb using <a href="https://helm.sh/docs/intro/install/" rel="nofollow noreferrer">Helm</a></p>
<pre><code>helm repo add bitnami https://charts.bitnami.com/bitnami
helm upgrade -i eramba bitnami/mariadb --set auth.rootPassword=eramba,auth.database=erambadb,initdbScriptsConfigMap=eramba,volumePermissions.enabled=true,primary.persistence.existingClaim=eramba-storage
</code></pre>
<p>Run eramba web application:</p>
<pre><code>cat &lt;&lt; EOF &gt; eramba-web.yaml
apiVersion: v1
kind: Pod
metadata:
  name: eramba-web
  labels:
    app.kubernetes.io/name: eramba-web
spec:
  containers:
  - name: eramba-web
    image: markz0r/eramba-app:c281
    imagePullPolicy: IfNotPresent
    env:
    - name: MYSQL_HOSTNAME
      value: eramba-mariadb
    - name: MYSQL_DATABASE
      value: erambadb
    - name: MYSQL_USER
      value: root
    - name: MYSQL_PASSWORD
      value: eramba
    - name: DATABASE_PREFIX
      value: &quot;&quot;
    ports:
    - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: eramba-web
  labels:
    app.kubernetes.io/name: eramba-web
spec:
  ports:
  - name: http
    nodePort: 30045
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app.kubernetes.io/name: eramba-web
  type: NodePort
...
EOF
</code></pre>
<p>Check all that required: <code>kubectl get cm,pvc,pv,svc,pods</code></p>
<p><a href="https://i.stack.imgur.com/wFXiu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wFXiu.png" alt="Up and running" /></a></p>
<p>You can now browse eramba-web via port-forward or http://<code>&lt;host ip&gt;</code>:30045.</p>
<p><code>kubectl port-forward service/eramba-web 8888:8080</code></p>
<p><a href="https://i.stack.imgur.com/flGx2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/flGx2.png" alt="Eramba login page" /></a></p>
