Skip to content

Setup Azurite Backupstore For Testing

Chris Chien edited this page Nov 26, 2024 · 1 revision

0. Test Environment

OS: SLES15 SP6

1. Deploy manifest

> kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/backupstores/azurite-backupstore.yaml

2. Install Azure CLI

Follow instruction https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt to install the Azure cli

Check installation success by perform command az version

> az version
{
  "azure-cli": "2.36.0",
  "azure-cli-core": "2.36.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {}
}

3. Forward azblob-service

Forward port 20001 traffic to port 10000 on the service

> kubectl port-forward --address 0.0.0.0 service/azblob-service 20001:10000

4. Eecode azblob-service IP address to base64

Get the cluster IP of azblob-service

> kubectl get svc
NAME             TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)     AGE
kubernetes       ClusterIP   10.43.0.1     <none>        443/TCP     6h3m
azblob-service   ClusterIP   10.43.81.75   <none>        10000/TCP   13m

Edcode the IP address to base64

> echo -n "http://10.43.81.75:10000/" | base64
aHR0cDovLzEwLjQzLjgxLjc1OjEwMDAwLw==

5. Update secret azblob-secret in namespace longhorn-system according to the encoded service IP

Update data.AZBLOB_ENDPOINT in secret azblob-secret in namespace longhorn-system to the result from step 3, shoud look as below

apiVersion: v1
data:
  AZBLOB_ACCOUNT_KEY: RWJ5OHZkTTAyeE5PY3FGbHFVd0pQTGxtRXRsQ0RYSjFPVXpGVDUwdVNSWjZJRnN1RnEyVVZFckN6NEk2dHEvSzFTWkZQVE90ci9LQkhCZWtzb0dNR3c9PQ==
  AZBLOB_ACCOUNT_NAME: ZGV2c3RvcmVhY2NvdW50MQ==
  AZBLOB_ENDPOINT: aHR0cDovLzEwLjQzLjgxLjc1OjEwMDAwLw==

6. Create container demo

Perform below command to create Azure container demo

> az storage container create -n demo --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://0.0.0.0:20001/devstoreaccount1;"

After the command, should see below reply

{
  "created": true
}

7. Set Longhorn backuptarget

Set backup-target to azblob://demo@core.windows.net/

Set backup-target-credential-secret to azblob-secret