服务器规划
源码编译
源码链接
代码修改代码地址
https://gitee.com/soyuangit/free-fs/tree/master
k8s
free-fs.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| apiVersion: apps/v1 kind: StatefulSet metadata: labels: app: free-fs name: free-fs spec: serviceName: free-fs replicas: 1 selector: matchLabels: app: free-fs template: metadata: labels: app: free-fs spec: nodeSelector: type: free-fs hostNetwork: true containers: - name: mysql image: mysql:5.7 volumeMounts: - mountPath: /var/lib/mysql name: mysql-volume env: - name: MYSQL_ROOT_PASSWORD value: "soyuan.123" - name: server image: java:8 volumeMounts: - mountPath: /svc name: fs-server-volume command: ["/bin/sh","-c","cd /svc && java -Djava.security.egd=file:/dev/./urandom -Duser.timezone=GMT+08 -jar app.jar"] - name: nginx image: nginx volumeMounts: - mountPath: /usr/share/nginx/html name: fs-server-volume - mountPath: /etc/nginx/conf.d name: nginx-conf-volume command: ["/bin/sh","-c","chown -R nginx /usr/share/nginx/html/file && /usr/sbin/nginx -g 'daemon off;'"] volumes: - name: mysql-volume hostPath: path: /free-fs-data/mysql type: Directory - name: fs-server-volume hostPath: path: /free-fs-data/server type: Directory - name: nginx-conf-volume hostPath: path: /free-fs-data/nginx/conf type: Directory
|
nginx 配置文件
default.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| server { listen 8000; server_name localhost;
location / { root /usr/share/nginx/html/file; }
error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
|
node设置labels
kubectl label nodes 172.16.100.225 type=free-fs
重启statefulsets
kubectl rollout restart statefulsets free-fs
创建目录
1 2 3 4 5 6 7
| # mysql 目录 $ mkdir -p /free-fs-data/mysql $ chmod 777 /free-fs-data/mysql # server 目录程序,jar包和配置文件,和文件缓存目录 $ mkdir -p /free-fs-data/server # nginx 反向代理目录,配置文件 $ mkdir -p /free-fs-data/nginx/conf
|