Skip to content

Commit 83f81fa

Browse files
Add FAQ entry for persistent volume using OCI FSS (#1425)
* Add FAQ entry for persistent volume using OCI FSS * Update init container command and FAQ text per review * Update oci-fss-pv.md * update the \magic command * fix magic command * Update init container command with extra bullet proof syntax * Update init container command properly this time! Co-authored-by: Mark Nelson <[email protected]>
1 parent 18e97a9 commit 83f81fa

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

docs-source/content/faq/oci-fss-pv.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: "Using OCI File Storage (FSS) for Persistent Volumes"
3+
date: 2020-02-12T12:12:12-05:00
4+
draft: false
5+
weight: 6
6+
---
7+
8+
If you are running your Kubernetes cluster on Oracle Container Engine
9+
for Kubernetes (commonly known as OKE), and you use OCI File Storage (FSS)
10+
for persistent volumes to store the WebLogic domain home, then the file system
11+
handling demonstrated in the operator persistent volume sample will require
12+
an update to properly initialize the file ownership on the persistent volume
13+
when the domain is initially created.
14+
15+
{{% notice note %}}
16+
File permission handling on persistent volumes can differ between
17+
cloud providers and even with the underlying storage handling on
18+
Linux based systems. These instructions provide one option to
19+
update file ownership used by the standard Oracle images where
20+
UID `1000` and GID `1000` typically represent the `oracle` or `opc` user.
21+
For more information on persistent volume handling,
22+
see [Persistent storage]({{< relref "/userguide/managing-domains/persistent-storage/_index.md" >}}).
23+
{{% /notice %}}
24+
25+
26+
### Failure during domain creation with persistent volume sample
27+
28+
The existing sample for [creation of a domain home on persistent volume](https://github.com/oracle/weblogic-kubernetes-operator/tree/master/kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv)
29+
uses a Kubernetes job to create the domain. The sample uses an
30+
`initContainers` section to change the file ownership which will
31+
fail for OCI FSS created volumes used with an OKE cluster.
32+
33+
The OCI FSS volume contains some files that are not modifiable thus
34+
causing the Kubernetes job to fail. The failure is seen in the
35+
description of the Kubernetes job pod:
36+
```bash
37+
$ kubectl describe -n domain1-ns pod domain1-create-weblogic-sample-domain-job-wdkvs
38+
:
39+
:
40+
Init Containers:
41+
fix-pvc-owner:
42+
Container ID: docker://7051b6abdc296c76e937246df03d157926f2f7477e63b6af3bf65f6ae1ceddee
43+
Image: container-registry.oracle.com/middleware/weblogic:12.2.1.3
44+
Image ID: docker-pullable://container-registry.oracle.com/middleware/weblogic@sha256:47dfd4fdf6b56210a6c49021b57dc2a6f2b0d3b3cfcd253af7a75ff6e7421498
45+
Port: <none>
46+
Host Port: <none>
47+
Command:
48+
sh
49+
-c
50+
chown -R 1000:1000 /shared
51+
State: Terminated
52+
Reason: Error
53+
Exit Code: 1
54+
Started: Wed, 12 Feb 2020 18:28:53 +0000
55+
Finished: Wed, 12 Feb 2020 18:28:53 +0000
56+
Ready: False
57+
Restart Count: 0
58+
Environment: <none>
59+
60+
:
61+
```
62+
63+
### Updating the domain on persistent volume sample
64+
In the following snippet of the [create-domain-job-template.yaml](https://github.com/oracle/weblogic-kubernetes-operator/blob/master/kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain-job-template.yaml),
65+
you can see the updated `command` for the init container:
66+
```
67+
apiVersion: batch/v1
68+
kind: Job
69+
metadata:
70+
name: %DOMAIN_UID%-create-weblogic-sample-domain-job
71+
namespace: %NAMESPACE%
72+
spec:
73+
template:
74+
metadata:
75+
:
76+
:
77+
spec:
78+
restartPolicy: Never
79+
initContainers:
80+
- name: fix-pvc-owner
81+
image: %WEBLOGIC_IMAGE%
82+
command: ["sh", "-c", "chown 1000:1000 %DOMAIN_ROOT_DIR%/. && find %DOMAIN_ROOT_DIR%/. -maxdepth 1 ! -name '.snapshot' ! -name '.' -print0 | xargs -r -0 chown -R 1000:1000"]
83+
volumeMounts:
84+
- name: weblogic-sample-domain-storage-volume
85+
mountPath: %DOMAIN_ROOT_DIR%
86+
securityContext:
87+
runAsUser: 0
88+
runAsGroup: 0
89+
containers:
90+
- name: create-weblogic-sample-domain-job
91+
image: %WEBLOGIC_IMAGE%
92+
93+
:
94+
```
95+
Use this new `command` in your copy of this template file. This will result in
96+
the ownership being updated for the expected files only, before the WebLogic
97+
domain is created on the persistent volume.

0 commit comments

Comments
 (0)