Exercise: roll out a simple deployment to set up a hosted service
- Create a 
deployment.yamlmanifest- Deploy the Hello Kubernetes container from Docker Hub
        
- Guidance on authoring deployment manifests
 
 - Label the pods
        
- In your spec.template for the deployment you can attach an app label:
            
metadata: labels: app: my-kubernetes-app 
 - In your spec.template for the deployment you can attach an app label:
            
 - Run the deployment using 
kubectlkubectl apply -f deployment.yaml
 - Verify the pods have been deployed successfully
        
kubectl get podskubectl get deployments
 
 - Deploy the Hello Kubernetes container from Docker Hub
        
 - Create a 
service.yamlmanifest to deploy the service- Guidance on authoring service manifests
 - Use the label from earlier to identify the pods that compose your service.
        
- In your spec.selector you can refer to the label you created earlier:
            
app: my-kubernetes-app 
 - In your spec.selector you can refer to the label you created earlier:
            
 
 - Test the service using a web browser.
 
This exercise builds on many of the previous labs for Docker and Terraform, parts 1, 2 and 3. If you’re attempting these exercises without completing the previous labs, you might need to use this Terraform Azure AKS solution to build a Kubernetes cluster to experiment on.
The solution to the ‘Kubernetes deployment and service’ exercise is available as a kubectl/YAML solution as part of our open-source Devops-Workstream.
      
Leave a comment