[ 部署到本地k8s[go-fastdfs] ]


部署到本地的kubesphere

一.docker参考命令

docker run --network=host --name fastdfs -v /data/fastdfs_data:/data -p 8080:8080 -e GO_FASTDFS_DIR=/data sjqzhang/go-fastdfs

二.k8s部署参考

pod.yaml

kind: Pod
apiVersion: v1
metadata:
  name: go-fast-pod-0
  generateName: go-fast-pod-
  namespace: chf-object
  labels:
    app: go-fast-pod
    controller-revision-hash: go-fast-pod-65f68f9f5c
    statefulset.kubernetes.io/pod-name: go-fast-pod-0
  annotations:
    cni.projectcalico.org/containerID: 4fef3d01434c30203564f2373e4dfaa89f2fb2699bfc4fd2f2c03f9a09695122
    cni.projectcalico.org/podIP: 10.233.84.237/32
    cni.projectcalico.org/podIPs: 10.233.84.237/32
    kubesphere.io/creator: admin
    kubesphere.io/imagepullsecrets: '{}'
    logging.kubesphere.io/logsidecar-config: '{}'
spec:
  volumes:
    - name: host-time
      hostPath:
        path: /etc/localtime
        type: ''
    - name: volume-vv8opg
      persistentVolumeClaim:
        claimName: go-fastdfs
    - name: kube-api-access-5s7r9
      projected:
        sources:
          - serviceAccountToken:
              expirationSeconds: 3607
              path: token
          - configMap:
              name: kube-root-ca.crt
              items:
                - key: ca.crt
                  path: ca.crt
          - downwardAPI:
              items:
                - path: namespace
                  fieldRef:
                    apiVersion: v1
                    fieldPath: metadata.namespace
        defaultMode: 420
  containers:
    - name: container-3tsuxq
      image: sjqzhang/go-fastdfs
      ports:
        - name: http-8080
          containerPort: 8080
          protocol: TCP
      env:
        - name: GO_FASTDFS_DIR
          value: /data
      resources: {}
      volumeMounts:
        - name: host-time
          readOnly: true
          mountPath: /etc/localtime
        - name: volume-vv8opg
          mountPath: /data
        - name: kube-api-access-5s7r9
          readOnly: true
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      imagePullPolicy: IfNotPresent
  restartPolicy: Always
  terminationGracePeriodSeconds: 30
  dnsPolicy: ClusterFirst
  serviceAccountName: default
  serviceAccount: default
  nodeName: chf-host
  securityContext: {}
  hostname: go-fast-pod-0
  subdomain: go-fast-pod-m96x
  schedulerName: default-scheduler
  tolerations:
    - key: node.kubernetes.io/not-ready
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/unreachable
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
  priority: 0
  enableServiceLinks: true
  preemptionPolicy: PreemptLowerPriority
---
kind: Service
apiVersion: v1
metadata:
  name: go-fastdfs-service
  namespace: chf-object
  labels:
    app: go-fastdfs-service
  annotations:
    kubesphere.io/creator: admin
spec:
  ports:
    - name: http-8080
      protocol: TCP
      port: 8080
      targetPort: 8080
      nodePort: 32595
  selector:
    app: go-fast-pod
  clusterIP: 10.233.9.138
  clusterIPs:
    - 10.233.9.138
  type: NodePort
  sessionAffinity: None
  externalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  internalTrafficPolicy: Cluster