Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
joohanhong
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JooHan Hong
joohanhong
Commits
ea790ea6
Commit
ea790ea6
authored
Mar 18, 2021
by
JooHan Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
k8s,swarm storage init
parent
03cf0426
Pipeline
#5232
passed with stages
in 44 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
240 additions
and
0 deletions
+240
-0
README.md
DOCKER/K8S/MIGRATION/STORAGE/README.md
+240
-0
No files found.
DOCKER/K8S/MIGRATION/STORAGE/README.md
0 → 100644
View file @
ea790ea6
[
![logo
](
https://www.hongsnet.net/images/logo.gif
)
](https://www.hongsnet.net)
# Storage 구조에 대한 비교 및 검토
> Docker Swarm과 K8s의 스토리지 구성을 비교하고, 도입 및 적용(**NFS 스토리지**)을 검토한다.
## Docker `Swarm`
Swarm은 단순하게 다음과 같이 volume을 명시해주면 된다.
```
python
version
:
'3'
services
:
hongsnet
:
image
:
registry
.
hongsnet
.
net
/
joohan
.
hong
/
docker
/
hongsnet
:
latest
volumes
:
-
HOME
:
/
home
-
EDU_DATA
:
/
home
/
edu
/
public_html
/
HongsBoard
/
Data
-
EDU_EDITOR
:
/
home
/
edu
/
public_html
/
HongsBoard
/
Web_editor
/
EDU
"
- EDU_FILE:/home/edu/public_html/HongsBoard/Web_editor/FILE"
-
HONGS_DATA
:
/
home
/
hongsnet
/
public_html
/
Data
"
- HONGS_EDITOR:/home/hongsnet/public_html/Web_editor/FILE"
-
NEWSYSTEM_DATA
:
/
home
/
newhongsystem
/
public_html
/
Data
"
- NEWSYSTEM_EDITOR:/home/newhongsystem/public_html/Web_editor/FILE"
ports
:
-
"80:80"
deploy
:
mode
:
global
placement
:
constraints
:
[
node
.
hostname
!=
TB2
-
DOCKER
]
update_config
:
parallelism
:
5
delay
:
10
s
restart_policy
:
condition
:
on
-
failure
max_attempts
:
3
window
:
120
s
volumes
:
HOME
:
driver_opts
:
type
:
"nfs"
o
:
"addr=192.192.0.254,nolock,soft,rw"
device
:
":/WEB_SRC/home"
EDU_DATA
:
driver_opts
:
type
:
"nfs"
o
:
"addr=192.192.0.254,nolock,soft,rw"
device
:
":/WEB_DATA/EDU/Data"
EDU_EDITOR
:
driver_opts
:
type
:
"nfs"
o
:
"addr=192.192.0.254,nolock,soft,rw"
device
:
":/WEB_DATA/EDU/Web_editor/EDU"
EDU_FILE
:
driver_opts
:
type
:
"nfs"
o
:
"addr=192.192.0.254,nolock,soft,rw"
device
:
":/WEB_DATA/EDU/Web_editor/FILE"
HONGS_DATA
:
driver_opts
:
type
:
"nfs"
o
:
"addr=192.192.0.254,nolock,soft,rw"
device
:
":/WEB_DATA/HONGSNET/Data"
HONGS_EDITOR
:
driver_opts
:
type
:
"nfs"
o
:
"addr=192.192.0.254,nolock,soft,rw"
device
:
":/WEB_DATA/HONGSNET/Web_editor/FILE"
NEWSYSTEM_DATA
:
driver_opts
:
type
:
"nfs"
o
:
"addr=192.192.0.254,nolock,soft,rw"
device
:
":/WEB_DATA/NEWHONGSYSTEM/Data"
NEWSYSTEM_EDITOR
:
driver_opts
:
type
:
"nfs"
o
:
"addr=192.192.0.254,nolock,soft,rw"
device
:
":/WEB_DATA/NEWHONGSYSTEM/Web_editor/FILE"
```
## `K8s`
K8s는 Swarm과 다르게, 다음과 같이 PV(
**persistentVolume**
),PVC(
**persistentVolumeClaim**
)라는 Volume으로 진행해야 한다.
> 생성 및 적용순서는 PV -> PVC -> Bound -> Use
-
**PersistentVolume, PersistentVolumeClian Object 생성**
다음과 같이 Ojbect를 생성하면 된다.
```
python
# cat nfs-volume.yaml
kind
:
PersistentVolume
apiVersion
:
v1
metadata
:
name
:
webdata
-
edu
-
volume
labels
:
type
:
local
spec
:
capacity
:
storage
:
100
Gi
accessModes
:
-
ReadWriteMany
volumeMode
:
Filesystem
mountOptions
:
-
soft
-
timeo
=
600
-
noatime
-
_netdev
-
retrans
=
3
-
rsize
=
65536
-
wsize
=
65536
nfs
:
server
:
"192.192.0.254"
path
:
"/WEB_DATA/EDU/Data"
---
apiVersion
:
v1
kind
:
PersistentVolumeClaim
metadata
:
name
:
webdata
-
edu
-
volume
-
pvc
spec
:
accessModes
:
-
ReadWriteMany
resources
:
requests
:
storage
:
100
Gi
volumeName
:
webdata
-
edu
-
volume
---
kind
:
PersistentVolume
apiVersion
:
v1
metadata
:
name
:
webeditor
-
edu
-
volume
labels
:
type
:
local
spec
:
capacity
:
storage
:
100
Gi
accessModes
:
-
ReadWriteMany
volumeMode
:
Filesystem
mountOptions
:
-
soft
-
timeo
=
600
-
noatime
-
_netdev
-
retrans
=
3
-
rsize
=
65536
-
wsize
=
65536
nfs
:
server
:
"192.192.0.254"
path
:
"/WEB_DATA/EDU/Web_editor/EDU"
---
apiVersion
:
v1
kind
:
PersistentVolumeClaim
metadata
:
name
:
webeditor
-
edu
-
volume
-
pvc
spec
:
accessModes
:
-
ReadWriteMany
resources
:
requests
:
storage
:
100
Gi
volumeName
:
webeditor
-
edu
-
volume
---
kind
:
PersistentVolume
apiVersion
:
v1
metadata
:
name
:
webeditorfile
-
edu
-
volume
labels
:
type
:
local
spec
:
capacity
:
storage
:
100
Gi
accessModes
:
-
ReadWriteMany
volumeMode
:
Filesystem
mountOptions
:
-
soft
-
timeo
=
600
-
noatime
-
_netdev
-
retrans
=
3
-
rsize
=
65536
-
wsize
=
65536
nfs
:
server
:
"192.192.0.254"
path
:
"/WEB_DATA/EDU/Web_editor/FILE"
---
apiVersion
:
v1
kind
:
PersistentVolumeClaim
metadata
:
name
:
webeditorfile
-
edu
-
volume
-
pvc
spec
:
accessModes
:
-
ReadWriteMany
resources
:
requests
:
storage
:
100
Gi
volumeName
:
webeditorfile
-
edu
-
volume
```
> 여기서는 아래에 사용중인 모든 볼륨의 Object를 표시하지않고, 위와 같은 형식으로 추가한다.
```
bash
# kubectl apply -f nfs-volume.yaml
```
현재 홍쓰넷에서 사용중인 Volume의 상태는 다음과 같다.
```
bash
# kubectl get pv,pvc
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
persistentvolume/webdata-edu-volume 100Gi RWX Retain Bound default/webdata-edu-volume-pvc 7h51m
persistentvolume/webdata-hongsnet-volume 100Gi RWX Retain Bound default/webdata-hongsnet-volume-pvc 7h51m
persistentvolume/webdata-newsystem-volume 100Gi RWX Retain Bound default/webdata-newsystem-volume-pvc 7h51m
persistentvolume/webeditor-edu-volume 100Gi RWX Retain Bound default/webeditor-edu-volume-pvc 7h51m
persistentvolume/webeditor-hongsnet-volume 100Gi RWX Retain Bound default/webeditor-hongsnet-volume-pvc 7h51m
persistentvolume/webeditor-newsystem-volume 100Gi RWX Retain Bound default/webeditor-newsystem-volume-pvc 7h51m
persistentvolume/webeditorfile-edu-volume 100Gi RWX Retain Bound default/webeditorfile-edu-volume-pvc 7h51m
persistentvolume/websrc-home-volume 100Gi RWX Retain Bound default/websrc-home-volume-pvc 7h51m
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
persistentvolumeclaim/webdata-edu-volume-pvc Bound webdata-edu-volume 100Gi RWX 7h51m
persistentvolumeclaim/webdata-hongsnet-volume-pvc Bound webdata-hongsnet-volume 100Gi RWX 7h51m
persistentvolumeclaim/webdata-newsystem-volume-pvc Bound webdata-newsystem-volume 100Gi RWX 7h51m
persistentvolumeclaim/webeditor-edu-volume-pvc Bound webeditor-edu-volume 100Gi RWX 7h51m
persistentvolumeclaim/webeditor-hongsnet-volume-pvc Bound webeditor-hongsnet-volume 100Gi RWX 7h51m
persistentvolumeclaim/webeditor-newsystem-volume-pvc Bound webeditor-newsystem-volume 100Gi RWX 7h51m
persistentvolumeclaim/webeditorfile-edu-volume-pvc Bound webeditorfile-edu-volume 100Gi RWX 7h51m
persistentvolumeclaim/websrc-home-volume-pvc Bound websrc-home-volume 100Gi RWX 7h51m
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment