Add an alias for an existing service to the IP address reservations in the System Layout Service (SLS). Adding these IP addresses will propagate the data needed for the Domain Name Service (DNS).
This procedure requires administrative privileges.
This example will add an alias to the pbs_service
in the Node Management Network (NMN).
-
Retrieve the SLS data for the network the service resides in.
export TOKEN=$(curl -s -k -S -d grant_type=client_credentials \ -d client_id=admin-client -d client_secret=`kubectl get secrets admin-client-auth \ -o jsonpath='{.data.client-secret}' | base64 -d` \ https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token \ | jq -r '.access_token') curl -s -k -H "Authorization: Bearer ${TOKEN}" \ https://api-gw-service-nmn.local/apis/sls/v1/networks/NMN|jq > NMN.json cp NMN.json NMN.json.bak
-
Edit the NMN.json file and add the desired alias in the ExtraProperties.Subnets section.
{ "Aliases": [ "pbs-service", "pbs-service-nmn", "pbs_service.local", "test-alias" ], "Comment": "pbs-service,pbs-service-nmn", "IPAddress": "10.252.2.5", "Name": "pbs_service" }
-
Upload the updated NMN.json file to SLS.
curl -s -k -H "Authorization: Bearer ${TOKEN}" --header \ "Content-Type: application/json" --request PUT --data @NMN.json \ https://api-gw-service-nmn.local/apis/sls/v1/networks/NMN
-
Verify that DNS records were created.
It will take about five minutes before any records will show up.
For example:
nslookup test-alias
Server: 10.92.100.225 Address: 10.92.100.225#53 Name: test-alias Address: 10.252.2.5