How to connect to samba server from container running in kubernetes?

Viewed 1427

I created a kubernetes cluster in amazon. Then I run my pod (container) and volume into this cluster. Now I want to run the samba server into the volume and connect my pod to samba server. Is there any tutorial how can I solve this problem? By the way I am working at windows 10. Here is my deployment code with volume:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: deployment
  labels:
    app : application
spec:
  replicas: 2
  selector:
    matchLabels:
      project: k8s
  template:
    metadata:
      labels:
        project: k8s
    spec:
      containers:
      - name : k8s-web
        image: mine/flask:latest
        volumeMounts:
          - mountPath: /test-ebs
            name: my-volume
        ports:
          - containerPort: 8080
      volumes:
        - name: my-volume
          persistentVolumeClaim:
            claimName: pv0004

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0004
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  awsElasticBlockStore:
    fsType: ext4
    volumeID: [my-Id-volume]
1 Answers

you can check out the smaba container docker image at : https://github.com/dperson/samba

---
kind: Service
apiVersion: v1
metadata:
  name: smb-server
  labels:
    app: smb-server
spec:
  type: LoadBalancer
  selector:
    app: smb-server
  ports:
    - port: 445
      name: smb-server
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: smb-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: smb-server 
  template:
    metadata:
      name: smb-server
      labels:
        app: smb-server
    spec:
      containers:
      - name: smb-server
        image: dperson/samba
        env:
        - name: PERMISSIONS 
          value: "0777"     
        args: ["-u", "username;test","-s","share;/smbshare/;yes;no;no;all;none","-p"]
        volumeMounts:
        - mountPath: /smbshare
          name: data-volume
        ports:
        - containerPort: 445
      volumes:
      - name: data-volume
        hostPath:
          path: /smbshare
          type: DirectoryOrCreate
Related