github.com/enmand/kubernetes@v1.2.0-alpha.0/docs/getting-started-guides/coreos/azure/expose_guestbook_app_port.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2014 The Kubernetes Authors All rights reserved.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  set -e
    18  
    19  [ ! -z $1 ] || (echo Usage: $0 ssh_conf; exit 1)
    20  
    21  fe_port=$(ssh -F $1 kube-00 \
    22    "/opt/bin/kubectl get -o template --template='{{(index .spec.ports 0).nodePort}}' services frontend -L name=frontend" \
    23  )
    24  
    25  echo "Guestbook app is on port $fe_port, will map it to port 80 on kube-00"
    26  
    27  ./node_modules/.bin/azure vm endpoint create kube-00 80 $fe_port
    28  
    29  ./node_modules/.bin/azure vm endpoint show kube-00 tcp-80-${fe_port}