Since you opened a new command prompt in the previous step, you'll need to return to the directory you created your service in.
Since you opened a new terminal in the previous step, you'll need to return to the directory you created your service in.
The AKS tools use a
.yaml file to define how to deploy your container.
Run the following command to create an empty
echo . > deploy-myMicroservice.yaml
deploy-myMicroservice.yaml file in the text editor of your choice and replace the contents with the following contents. Make sure to replace
[YOUR DOCKER ID] with your actual Docker ID.
--- apiVersion: apps/v1 kind: Deployment metadata: name: mymicroservice spec: replicas: 1 template: metadata: labels: app: mymicroservice spec: containers: - name: mymicroservice image: [YOUR DOCKER ID]/mymicroservice:latest ports: - containerPort: 80 env: - name: ASPNETCORE_URLS value: http://*:80 selector: matchLabels: app: mymicroservice --- apiVersion: v1 kind: Service metadata: name: mymicroservice spec: type: LoadBalancer ports: - port: 80 selector: app: mymicroservice
Run the following command to deploy based on the the settings in
kubectl apply -f deploy-myMicroservice.yaml
Run the following command to see the details of your deployed service:
kubectl get service mymicroservice --watch
Among other things, the previous command will show the external IP address that your service is available on (
Using the external IP address, open a new browser window and navigate to
http://[YOUR EXTERNAL IP ADDRESS]/WeatherForecast
EXTERNAL-IP is marked as
<pending>, a new line will automatically appear once the external IP has been allocated.
Press CTRL+C on your command prompt to end the
kubectl get service command.
Press CTRL+C on your terminal to end the
kubectl get service command
Congratulations! You've deployed a microservice to Azure.