How can I expose a service in a node in kubernetes 1.0? -
i created docker local install of kubernetes , able create replicas , services bellow (this kubernetes 201):
rc:
apiversion: v1 kind: replicationcontroller metadata: name: nginx-controller spec: replicas: 2 # selector identifies set of pods # replication controller responsible managing selector: app: nginx # podtemplate defines 'cookie cutter' used creating # new pods when necessary template: metadata: labels: # important: these labels need match selector above # api server enforces constraint. app: nginx spec: containers: - name: nginx image: nginx ports: - containerport: 80
and service.yaml:
apiversion: v1 kind: service metadata: name: nginx-service spec: ports: - port: 8000 # port service should serve on # container on each pod connect to, can name # (e.g. 'www') or number (e.g. 80) targetport: 80 protocol: tcp nodeport: 30000 type: loadbalancer # selector in replication controller, # time identifies set of pods load balance # traffic to. selector: app: nginx
from understanding, should able access service port 30000 in node, empty response. help?
if running kubernetes non-root, may need check port range if non-root allowed open port.
never tried way can open port on nodes particular container through replicationcontroller adding hostport: 30000
below - containerport: 80
Comments
Post a Comment