> For the complete documentation index, see [llms.txt](https://utm-1.gitbook.io/utm-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utm-1.gitbook.io/utm-docs/dokumentaciya/utm-it/resheniya/kubernetes/prilozheniya/csi/csi-driver-smb.md).

# csi-driver-smb

## Ссылки

kubernetes-csi / csi-driver-smb: [github.com](https://github.com/kubernetes-csi/csi-driver-smb/tree/master/charts)

## Установка

### Установка через Argo CD

В github в репозитории argocd в каталоге `env-prod\apps` создать подкаталог `csi\csi-driver-smb` в котором создать файл `app.yaml` следующего содержания:

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name     : csi-driver-smb
  namespace: argocd
spec:
  project: default
  destination:
    name     : in-cluster
    namespace: kube-system
  sources:
  - repoURL: git@github.com:utenkov-maxim/argocd.git
    targetRevision: HEAD
    ref: values
  - chart: csi-driver-smb
    repoURL: https://raw.githubusercontent.com/kubernetes-csi/csi-driver-smb/master/charts
    targetRevision: v1.19.1
    helm:
      releaseName: csi-driver-smb
      valueFiles:
      - $values/env-prod/apps/csi/csi-driver-smb/values.yaml
  - repoURL: git@github.com:utenkov-maxim/argocd.git
    targetRevision: HEAD
    path: "env-prod/apps/csi/csi-driver-smb/manifests"
  syncPolicy:
    automated:
      prune   : true
      selfHeal: true
    syncOptions:
      - ServerSideApply=true
```

В каталоге `csi\csi-driver-smb` создать подкаталог `manifests` в котором создать следующие файлы:

**smbcreds-utm-server4.yaml**

```yaml
apiVersion: v1
kind: Secret
metadata:
  name: smbcreds-utm-server4
  namespace: kube-system
type: Opaque
data:
  username: <username в base64>
  password: <password в base64>
  domain: <domain в base64>  # WORKGROUP

# Зашифровать
# echo -n "<username в открытом виде>" | base64
# echo -n "<password в открытом виде>" | base64
# echo -n "<domain в открытом виде>" | base64

# Посмотреть
# kubectl get secret smbcreds-utm-server4 -n kube-system -o jsonpath="{.data.username}" | base64 -d
# kubectl get secret smbcreds-utm-server4 -n kube-system -o jsonpath="{.data.password}" | base64 -d
```

В каталоге `csi\csi-driver-smb` внести изменения в файл `values.yaml` (базовый файл взять [отсюда](https://github.com/kubernetes-csi/csi-driver-smb/tree/master/charts/v1.19.1/csi-driver-smb))

{% hint style="info" %}
Всё что необходимо изменить в файле `values.yaml` смотри в репозитории argocd в реальном файле. Все изменения помечены меткой `TEST!!!`
{% endhint %}

Основные изменения в файле `values.yaml`:

```yaml
controller:
...
  replicas: 2       #!!! Было  1
...
  runOnControlPlane: true      #!!! Было  false, установлено true в соответствии с советом https://github.com/kubernetes-csi/csi-driver-smb/tree/master/charts
...

storageClasses:
  - name: smb-csi-utm-server4
    annotations:
      storageclass.kubernetes.io/is-default-class: "true"
    parameters:
      source: "//192.168.1.4/k8s-pvs"
      # if csi.storage.k8s.io/provisioner-secret is provided, will create a sub directory
      # with PV name under source
      csi.storage.k8s.io/provisioner-secret-name: smbcreds-utm-server4
      csi.storage.k8s.io/provisioner-secret-namespace: kube-system
      csi.storage.k8s.io/node-stage-secret-name: smbcreds-utm-server4
      csi.storage.k8s.io/node-stage-secret-namespace: kube-system
    reclaimPolicy: Retain     # Retain чтобы после удаления pvc папка оставалась, Delete после удаления pvc папка удаляется
    volumeBindingMode: Immediate
    allowVolumeExpansion: true
    mountOptions:
      - dir_mode=0777
      - file_mode=0777
      - noperm
      - mfsymlinks
      - cache=strict
      - noserverino  # required to prevent data corruption
```

Сделать коммит в github. После этого Argo CD развернет csi-driver-smb в связанном кластере Kubernetes.

В итоге, в кластере будут установлены:

* sci драйвер `csi-driver-smb`
* StorageClass: `smb-csi-utm-server4`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://utm-1.gitbook.io/utm-docs/dokumentaciya/utm-it/resheniya/kubernetes/prilozheniya/csi/csi-driver-smb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
