https://github.com/epomatti/azure-vm-cni
Azure CNI from a Virtual Machine containerized app
https://github.com/epomatti/azure-vm-cni
azure azure-cni azure-security cni cni-plugin docker go golang service-endpoint service-endpoints terraform
Last synced: 7 months ago
JSON representation
Azure CNI from a Virtual Machine containerized app
- Host: GitHub
- URL: https://github.com/epomatti/azure-vm-cni
- Owner: epomatti
- License: mit
- Created: 2023-12-10T04:36:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-31T00:39:30.000Z (almost 2 years ago)
- Last Synced: 2025-01-17T18:34:54.846Z (9 months ago)
- Topics: azure, azure-cni, azure-security, cni, cni-plugin, docker, go, golang, service-endpoint, service-endpoints, terraform
- Language: HCL
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Azure VM CNI
Enabling containers to use Azure Virtual Network capabilities with [Azure CNI][1] and Azure Virtual Machines.
> 💡 The documentation implies that CNI is required for containers to use Virtual Network capabilities, however, after finishing this project I discovered that CNI was not required to use Service Endpoints from a Virtual Machine. Maybe it is already installed or something, did not investigate.
## Azure deploy
Set the `.auto.tfvars` file:
```sh
cp config/template.tfvars .auto.tfvars
```Create the infrastructure:
```sh
terraform init
terraform apply -auto-approve
```Confirm that `cloud-init` has complete successfully.
Manually select the Service Endpoint Policy as it was having circular dependency issues.
Connect via SSH to the virtual machine.
Run the command to star the app container:
```sh
sudo docker run -p 8080:8080 \
-e 'MSSQL_HOSTNAME=sqls-cni.database.windows.net' \
-e 'MSSQL_PORT=1433' \
-e 'MSSQL_USERNAME=dbadmin' \
-e 'MSSQL_PASSWORD=P4ssw0rd!2023' \
epomatti/azure-vm-cni-app:arm64
```Teste the database connection:
```sh
curl :8080/query
```## Local development
Set the `.env` file.
Start the database:
```sh
docker run -p 1433:1433 -e ACCEPT_EULA=Y -e SA_PASSWORD=P@ssw0rd.123 mcr.microsoft.com/mssql/server:2022-latest
```Run the application:
```sh
cd appgo run .
```[1]: https://learn.microsoft.com/en-us/azure/virtual-network/container-networking-overview