kubernetes: AzureFile Mount fails - putting new line between storage account and domain

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug

/kind feature

What happened: When trying to mount an Azure File mount it fails, it looks as though its putting a new line between the name of the Azure Storage Account and the Azure storage domain. There are no new line characters in the secret that holds the account name.

The following is the secret:

apiVersion: v1
kind: Secret
metadata:
  name: asa-otm
  labels:
    app: my-app
    role: secret
    env: dev
type: Opaque
data:
  azurestorageaccountname: c2FhdXNucHJkZGV2b3RtCg==
  azurestorageaccountkey: PASSWORD  

The following is the declaration within the container section of the Kubernetes yaml:

        volumeMounts:
        - name: asa-otm
          mountPath: /opt/my-app/otm
      volumes:
      - name: asa-otm
        azureFile:
          secretName: asa-otm
          shareName: otm
          readOnly: false

The following is the error that’s shown in `kubectl describe po/pod_name:

Warning  FailedMount            11s                kubelet, k8s-agentpool0-18189144-2  MountVolume.SetUp failed for volume "asa-otm" : mount failed: exit status 1
Mounting command: mount
Mounting arguments: -t cifs -o username=saausnprddevotm
,password=PASSWORD
,file_mode=0755,dir_mode=0755,vers=3.0 //saausnprddevotm
.file.core.windows.net/otm /var/lib/kubelet/pods/3ae17688-4cdd-11e8-9240-000d3ae0c5ae/volumes/kubernetes.io~azure-file/asa-otm
Output: mount error: could not resolve address for saausnprddevotm
.file.core.windows.net: Unknown error

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version): v1.9.4
  • Cloud provider or hardware configuration: azure
  • OS (e.g. from /etc/os-release): Ubuntu 16.04.3 LTS
  • Kernel (e.g. uname -a): 4.13.0-1011-azure
  • Install tools: acs-engine
  • Others: acs-engine #2818

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

@Hyper200 yes it’s echo -n

c2FhdXNucHJkZGV2b3RtCg== is specified by user, so trim the \n is not a good idea in the code.

Another simple way is to use kubectl create secret to create azure-secret, the accountname and key won’t require base64 encoded, so you won’t mess up with \n

kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountkey="KEY" --type=Opaque

@BrendanThompson @xinsnake let me know if you have any question, thanks.