This is part 2 of Kubernetes Deploy Example, in this example, we will use the yaml file to deploy a nginx.
In this example, we have combined the Deployment part and the Service part together. We could deploy them at the same time.
1 | apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 |
Step 1: Apply applications with yaml file
1 | kubectl apply -f ./deployment.yaml |
Step 2: Get kubernetes ip
1 | kubectl get endpoints kubernetes |
Step 3: Access to nginx
Open your navigator and type the url of kubernetes with the port of nginx(we defined 32000 in the yaml file), you will access to welcome page of nginx
1 | http://192.168.99.100:32000 |