Skip to content
This repository was archived by the owner on Dec 29, 2023. It is now read-only.

Unable to deploy this apps on OpenShift #763

Open
coolpalani opened this issue Mar 14, 2018 · 8 comments
Open

Unable to deploy this apps on OpenShift #763

coolpalani opened this issue Mar 14, 2018 · 8 comments

Comments

@coolpalani
Copy link

I am trying to deploy this micro service on OpenShift 3.7. It's throwing an error message while create catalogue-db pods

NAME READY STATUS RESTARTS AGE
catalogue-db-1846494424-2j29q 0/1 CrashLoopBackOff 6 8m

Error message

Initializing database
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
2018-03-14T13:11:18.115358Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-03-14T13:11:18.120035Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2018-03-14T13:11:18.120064Z 0 [ERROR] Aborting

@rade
Copy link
Contributor

rade commented Mar 15, 2018

That's odd. I suspect the volume creates as a result of the VOLUME declaration ends up being read-only. Perhaps that's some strange OpenShift default permissions issue.

@coolpalani
Copy link
Author

It seems permission issue.
We need to add user: "1000:50" in docker file.

workaround solutions provided here: docker-library/mysql#219

We are directly pulling docker image "weaveworksdemos/catalogue-db:0.3.0" but not creating any docker image as manually.
could you guide me where I have to insert this permission complete-demo.yaml file

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: catalogue-db
labels:
name: catalogue-db
namespace: sock-shop
spec:
replicas: 1
template:
metadata:
labels:
name: catalogue-db
spec:
containers:
- name: catalogue-db
image: weaveworksdemos/catalogue-db:0.3.0
env:
- name: MYSQL_ROOT_PASSWORD
value: fake_password
- name: MYSQL_DATABASE
value: socksdb
ports:
- name: mysql
containerPort: 3306
nodeSelector:
beta.kubernetes.io/os: linux

@rade
Copy link
Contributor

rade commented Mar 15, 2018

Are you sure that will solve the problem? The catalogue-db k8s manifest isn't mounting any dirs from the host into the container.

Nevertheless, to experiment, I suggest creating your own catalogue-db image.

@coolpalani
Copy link
Author

Let me try with 0.3.5 docker image https://hub.docker.com/r/weaveworksdemos/catalogue-db/tags/

@coolpalani
Copy link
Author

@rade

I eventually deployed this application in OpenShift :)

[root@master ~]# oc get pods
NAME READY STATUS RESTARTS AGE
carts-515570173-69nkf 1/1 Running 0 56m
carts-db-224813618-4kdcl 1/1 Running 0 1h
catalogue-3634130434-nwfgg 1/1 Running 0 1h
catalogue-db-4001046256-dbj5d 1/1 Running 0 46m
front-end-4148163561-5xbsk 1/1 Running 0 42m
orders-3874398928-2w49n 1/1 Running 0 1h
orders-db-1112365690-n5lnl 1/1 Running 0 1h
payment-716517544-l9zj6 1/1 Running 0 59m
queue-master-2067646375-4w8kj 1/1 Running 0 1h
rabbitmq-2169020979-blv2b 1/1 Running 0 59m
shipping-1884913266-8v5hm 1/1 Running 0 58m
user-1155543707-7cl4s 1/1 Running 0 57m
user-db-1749560319-7jt9l 1/1 Running 0 58m

Fix: I removed all the security context and run catalogue-db as user 0
It may not be best practice, but we have to run this application for experimental. The way of this application design for kubernetes, they are more focused in security. In OpenShift each project will be isolated, hopefully not going to harm.

Thanks for your support

@sunilk747
Copy link

@coolpalani Can you share your yaml which you used it to deploy it to openshift

@spzorn123
Copy link

Think i am getting a similar issue. What was the fix?

Initializing database
  | mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
  | 2019-03-16T05:43:04.624144Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  | 2019-03-16T05:43:04.625694Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
 

@spzorn123
Copy link

It seems permission issue.
We need to add user: "1000:50" in docker file.

workaround solutions provided here: docker-library/mysql#219

We are directly pulling docker image "weaveworksdemos/catalogue-db:0.3.0" but not creating any docker image as manually.
could you guide me where I have to insert this permission complete-demo.yaml file

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: catalogue-db
labels:
name: catalogue-db
namespace: sock-shop
spec:
replicas: 1
template:
metadata:
labels:
name: catalogue-db
spec:
containers:

  • name: catalogue-db
    image: weaveworksdemos/catalogue-db:0.3.0
    env:
  • name: MYSQL_ROOT_PASSWORD
    value: fake_password
  • name: MYSQL_DATABASE
    value: socksdb
    ports:
  • name: mysql
    containerPort: 3306
    nodeSelector:
    beta.kubernetes.io/os: linux

@coolpalani did you ever get this running on OpenShift?

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

No branches or pull requests

4 participants