From 31a4ba8fa90efb4e287bfa3097875b6df456769a Mon Sep 17 00:00:00 2001 From: Joe Monk Date: Tue, 8 Jul 2025 21:48:51 +0100 Subject: [PATCH] Try other samba share --- .../local-path-provisioner/helmrelease.yaml | 1 - clusters/kairos/samba-server/configmap.yaml | 80 ++++++------------- clusters/kairos/samba-server/deployment.yaml | 19 +---- .../kairos/samba-server/kustomization.yaml | 5 +- clusters/kairos/samba-server/service.yaml | 14 ++++ kairos-reset.yaml | 4 +- readme.md | 7 ++ 7 files changed, 55 insertions(+), 75 deletions(-) create mode 100644 clusters/kairos/samba-server/service.yaml diff --git a/clusters/kairos/local-path-provisioner/helmrelease.yaml b/clusters/kairos/local-path-provisioner/helmrelease.yaml index 1a95c91..b0a1546 100644 --- a/clusters/kairos/local-path-provisioner/helmrelease.yaml +++ b/clusters/kairos/local-path-provisioner/helmrelease.yaml @@ -1,4 +1,3 @@ - apiVersion: helm.toolkit.fluxcd.io/v2 kind: HelmRelease metadata: diff --git a/clusters/kairos/samba-server/configmap.yaml b/clusters/kairos/samba-server/configmap.yaml index f2d62c4..c0deb5e 100644 --- a/clusters/kairos/samba-server/configmap.yaml +++ b/clusters/kairos/samba-server/configmap.yaml @@ -3,57 +3,29 @@ kind: ConfigMap metadata: name: samba-config data: - config.json: | - { - "samba-container-config": "v0", - "configs": { - "local": { - "shares": [ - "share" - ], - "globals": [ - "default" - ], - "instance_name": "SAMBA" - } - }, - "shares": { - "share": { - "options": { - "path": "/share", - "valid users": "sambauser", - "writeable": "yes", - "guest ok": "yes", - "guest only": "yes" - } - } - }, - "globals": { - "default": { - "options": { - "security": "user", - "server min protocol": "SMB2", - "load printers": "no", - "printing": "bsd", - "printcap name": "/dev/null", - "disable spoolss": "yes", - "guest ok": "yes", - "browsable": "yes", - "writable": "yes", - "guest account": "sambauser", - "create mask": "0775", - "directory mask": "0755", - "map to guest": "bad user" - } - } - }, - "users": { - "all_entries": [ - { - "name": "sambauser", - "password": "samba" - } - ] - }, - "_footer": 1 - } \ No newline at end of file + smb.default: | + [global] + server string = samba + idmap config * : range = 3000-7999 + security = user + server min protocol = SMB2 + + map to guest = Bad User + guest account = samba + + # disable printing services + load printers = no + printing = bsd + printcap name = /dev/null + disable spoolss = yes + + [Share] + path = /storage + comment = Shared + valid users = @smb + browseable = yes + writable = yes + read only = no + + printable = no + public = yes \ No newline at end of file diff --git a/clusters/kairos/samba-server/deployment.yaml b/clusters/kairos/samba-server/deployment.yaml index a928b41..59e964b 100644 --- a/clusters/kairos/samba-server/deployment.yaml +++ b/clusters/kairos/samba-server/deployment.yaml @@ -18,21 +18,9 @@ spec: spec: containers: - name: samba - image: quay.io/samba.org/samba-server:latest - securityContext: - privileged: true - capabilities: - add: ["NET_ADMIN"] - hostNetwork: true - dnsPolicy: ClusterFirstWithHostNet + image: dockurr/samba:latest ports: - containerPort: 445 - hostPort: 445 - env: - - name: SAMBACC_CONFIG - value: /etc/samba-container/config.json - - name: SAMBA_CONTAINER_ID - value: local resources: limits: cpu: 1000m @@ -41,14 +29,15 @@ spec: cpu: 10m memory: 64Mi volumeMounts: - - mountPath: /share + - mountPath: /storage name: local-path - - mountPath: /etc/samba-container + - mountPath: /etc/samba name: samba-config volumes: - name: local-path hostPath: path: /usr/local/data + type: DirectoryOrCreate - name: samba-config configMap: name: samba-config \ No newline at end of file diff --git a/clusters/kairos/samba-server/kustomization.yaml b/clusters/kairos/samba-server/kustomization.yaml index 0da17be..f225ba3 100644 --- a/clusters/kairos/samba-server/kustomization.yaml +++ b/clusters/kairos/samba-server/kustomization.yaml @@ -2,5 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: kube-system resources: -- configmap.yaml -- deployment.yaml \ No newline at end of file + - configmap.yaml + - deployment.yaml + - service.yaml diff --git a/clusters/kairos/samba-server/service.yaml b/clusters/kairos/samba-server/service.yaml new file mode 100644 index 0000000..76fe08a --- /dev/null +++ b/clusters/kairos/samba-server/service.yaml @@ -0,0 +1,14 @@ +kind: Service +apiVersion: v1 +metadata: + name: samba + namespace: kube-system + labels: + app: samba +spec: + type: LoadBalancer + selector: + app: samba + ports: + - port: 445 + name: samba diff --git a/kairos-reset.yaml b/kairos-reset.yaml index cb079aa..ed35359 100644 --- a/kairos-reset.yaml +++ b/kairos-reset.yaml @@ -55,7 +55,7 @@ stringData: mount --rbind /host/dev /dev mount --rbind /host/run /run nsenter -i -m -t 1 -- reboot - exit 1 + exit 1 --- apiVersion: upgrade.cattle.io/v1 kind: Plan @@ -72,8 +72,6 @@ spec: serviceAccountName: system-upgrade cordon: false upgrade: - # Here goes the image which is tied to the flavor being used. - # Currently can pick between opensuse and alpine image: quay.io/kairos/debian:bookworm-standard-amd64-generic-v3.3.0-k3sv1.32.0-k3s1 command: - "/bin/bash" diff --git a/readme.md b/readme.md index 7b6eb71..302cfbc 100644 --- a/readme.md +++ b/readme.md @@ -111,3 +111,10 @@ You should be able to access `http://traefik.k3s/dashboard#/` (at the time of wr ## Grafana Grab the admin user password from the `monitoring-grafana` secret + +## Removing a PVC + +After removing a pvc, you may need to force the removal by patching the finalize out + +`kubectl delete pv --grace-period=0 --force` +`kubectl patch pv -p '{"metadata": {"finalizers": null}}'` \ No newline at end of file