mirror of
https://github.com/slurm-personal/school-dev-k8s.git
synced 2026-06-27 13:50:24 +00:00
Add basic info
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# PV/PVC
|
||||
|
||||
1) Применяем манифест pvc.yml
|
||||
|
||||
```bash
|
||||
kubectl apply -f ~/slurm/practice/4.saving-data/3.pvc/pvc.yaml
|
||||
|
||||
kubectl get pvc
|
||||
kubectl get pv
|
||||
```
|
||||
|
||||
2) Запустим приложение, использующее PV
|
||||
|
||||
```bash
|
||||
kubectl apply -f ~/slurm/practice/4.saving-data/3.pvc/
|
||||
```
|
||||
|
||||
3) Посмотрим describe и смонтированные тома в контейнере
|
||||
|
||||
```bash
|
||||
kubectl describe pod fileshare-<TAB>
|
||||
kubectl exec -it fileshare-<TAB> -- df -h
|
||||
```
|
||||
|
||||
4) Очищаем
|
||||
|
||||
```bash
|
||||
kubectl delete -f ~/slurm/practice/4.saving-data/3.pvc/
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: fileshare
|
||||
data:
|
||||
default.conf: |
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
default_type text/plain;
|
||||
|
||||
location / {
|
||||
return 200 '$hostname\n';
|
||||
}
|
||||
|
||||
location /files {
|
||||
alias /data;
|
||||
autoindex on;
|
||||
client_body_temp_path /tmp;
|
||||
dav_methods PUT DELETE MKCOL COPY MOVE;
|
||||
create_full_put_path on;
|
||||
dav_access user:rw group:rw all:r;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: fileshare
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: fileshare
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 1
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: fileshare
|
||||
spec:
|
||||
initContainers:
|
||||
- image: busybox
|
||||
name: mount-permissions-fix
|
||||
command: ["sh", "-c", "chmod 777 /data"]
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
containers:
|
||||
- image: centosadmin/reloadable-nginx:1.12
|
||||
name: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 100Mi
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/nginx/conf.d
|
||||
- name: data
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: fileshare
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: fileshare
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: fileshare
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
Reference in New Issue
Block a user