mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 11:42:14 +00:00
Adding seimple service to the demo setion
This commit is contained in:
@@ -608,6 +608,23 @@ On the Kubernetes Master node lets create a '''nginx.yml'''
|
||||
image: dockerfile/nginx
|
||||
|
||||
|
||||
Now for the service: ```nginx-service.yml```
|
||||
|
||||
kind: Service
|
||||
apiVersion: v1beta1
|
||||
# must be a DNS compatible name
|
||||
id: nginx-example
|
||||
# the port that this service should serve on
|
||||
port: 80
|
||||
# just like the selector in the replication controller,
|
||||
# but this time it identifies the set of pods to load balance
|
||||
# traffic to.
|
||||
selector:
|
||||
name: www
|
||||
# the container on each pod to connect to, can be a name
|
||||
# (e.g. 'www') or a number (e.g. 80)
|
||||
containerPort: 80
|
||||
|
||||
Now add the pod to Kubernetes:
|
||||
|
||||
kubectl create -f nginx.yml
|
||||
|
Reference in New Issue
Block a user