Kubernetes部署NextCloud网盘

  sre


NextCloud 是一款开源网络硬盘系统。任何人都可以自由的获取 NextCloud 程序,在家庭或公司构建私有且免费的网络硬盘。
Nextcloud 提供 Android、iOS 和 PC 桌面客户端,它们通过完全加密的链接同步和共享你的数据。移动客户端支持自动同步照片和视频,同时支持选择同步。

pvc nextcloud

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nextcloud
  namespace: sre
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: "250Gi"
  volumeName: 
  storageClassName: nfs


Deployment nextcloud

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nextcloud
  namespace: sre
  labels:
    app: nextcloud
spec:
  selector:
    matchLabels:
      app: nextcloud
  template:
    metadata:
      labels:
        app: nextcloud
    spec:
      containers:
      - name: nextcloud
        image: nextcloud
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
          name: http

        volumeMounts:
        - name: pvc-data
          mountPath: /var/www/html
      volumes:
      - name: pvc-data
        persistentVolumeClaim:
          claimName: nextcloud

svc nextcloud

apiVersion: v1
kind: Service
metadata:
  name: nextcloud
  namespace: sre
spec:
  ports:
  - name: http
    protocol: TCP
    port: 80
    targetPort: http
  selector:
    app: nextcloud

secret

kubectl -n sre  create secret tls tls-disk-yourdomain-com --cert=disk.yourdomain.com.pem --key=disk.yourdomain.com.key
kubectl -n sre get secret
kubectl -n sre describe secret tls-disk-yourdomain-com

Ingress

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: disk-yourdomain-com
  namespace: sre
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: 10240m
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"

spec:
  tls:
  - hosts:
    - disk.yourdomain.com
    secretName: tls-disk-yourdomain-com
  rules:
  - host: disk.yourdomain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: nextcloud
          servicePort: 80

加载完成后即可访问了

输入管理员和密码,开始安装


安装完成

LEAVE A COMMENT

Captcha Code