The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

347175 (6) [Avatar] Offline
#1
replication controller and pods created okay ...

 ??   >cat kubia-rc-named-ports.yaml 
apiVersion: v1
kind: ReplicationController
metadata:
  name: kubia
spec:
  replicas: 3
  selector:
    app: kubia
  template:
    metadata:
      labels:
        app: kubia
    spec:
      containers:
      - name: kubia
        image: luksa/kubia
        ports:
        - name: http
          containerPort: 8080
        - name: https
          containerPort: 8443

 ??   >kubectl create -f kubia-rc-named-ports.yaml 
replicationcontroller "kubia" created

 ??   >kubectl get rc
NAME      DESIRED   CURRENT   READY     AGE
kubia     3         3         3         12s

 ??   >kubectl get po
NAME          READY     STATUS    RESTARTS   AGE
kubia-5fg5z   1/1       Running   0          17s
kubia-8fvxb   1/1       Running   0          17s
kubia-txw8j   1/1       Running   0          17s


service does NOT create okay ...

 ??   >cat kubia-svc-named-ports.yaml 
apiVersion: v1
kind: Service
metadata:
  name: kubia
spec:
  ports:
  - port: 80
    targetPort: http
  - port: 443
    targetPort: https
  selector:
    app: kubia

 ??   >kubectl create -f kubia-svc-named-ports.yaml 
The Service "kubia" is invalid: 
* spec.ports[0].name: Required value
* spec.ports[1].name: Required value


Using GKE version 1.6.7:

 ??   >gcloud container clusters list
NAME             ZONE           MASTER_VERSION  MASTER_IP       MACHINE_TYPE   NODE_VERSION  NUM_NODES  STATUS
example-cluster  us-central1-a  1.6.7           88.888.888.888  n1-standard-1  1.6.7         3          RUNNING

Marko Lukša (70) [Avatar] Online
#2
Ah, yes, I forgot to add names to the ports. I've now added a callout to emphasize that you need to specify port names when creating a multi-port service.

Thanks.