Create a secret with an Azure service principal client credentials, tenant id, and subscription id.
apiVersion: v1
kind: Secret
metadata:
name: azure
type: Opaque
data:
AZURE_CLIENT_ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AZURE_CLIENT_SECRET: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AZURE_TENANT_ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AZURE_SUBSCRIPTION_ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Run the operator with the following manifest.
apiVersion: apps/v1
kind: Deployment
metadata:
name: azure-fqdn-operator
spec:
replicas: 1
selector:
matchLabels:
name: azure-fqdn-operator
template:
metadata:
labels:
name: azure-fqdn-operator
spec:
containers:
- name: azure-fqdn-operator
image: neilpeterson/azure-fqdn-operator
ports:
- containerPort: 60000
name: metrics
command:
- azure-fqdn-operator
imagePullPolicy: Always
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: AZURE_CLIENT_ID
valueFrom:
secretKeyRef:
name: azure
key: AZURE_CLIENT_ID
- name: AZURE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: azure
key: AZURE_CLIENT_SECRET
- name: AZURE_TENANT_ID
valueFrom:
secretKeyRef:
name: azure
key: AZURE_TENANT_ID
- name: AZURE_SUBSCRIPTION_ID
valueFrom:
secretKeyRef:
name: azure
key: AZURE_SUBSCRIPTION_ID
- name: OPERATOR_NAME
value: "azure-fqdn-operator"
Create a service with the following annotations.
value | description |
---|---|
azure-fqdn-value | DNS prefix name |
azure-fqdn-rg | AKS node resource group (MC_..) |
azure-fqdn-location | Resource group location |
Example:
apiVersion: v1
kind: Service
metadata:
name: service-annotation-is-lb-5
annotations: {
"azure-fqdn-value": "demo-app-030",
"azure-fqdn-rg": "MC_scottyCarbone_scottyCarbone_eastus",
"azure-fqdn-location": "eastus"
}
spec:
type: LoadBalancer
ports:
- port: 80
Once run, the Azure Public IP Address assigned to the service will be updated with a DNS name.