Yoshiki Shibata (11) [Avatar] Offline
#1
Question on page 136: <nodes> is not shown in the EXTERNAL-IP
On page 136:

$ kubectl get svc kubia-nodeport
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubia-nodeport 10.111.254.223 <nodes> 80:30123/TCP 2m


But <nodes> is not shown. Instead, <none> is shown, but the system is working. Why?

$ kubectl get svc kubia-nodeport
NAME             TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubia-nodeport   NodePort   10.35.254.179   <none>        80:30123/TCP   14m


334960 (3) [Avatar] Offline
#2
Question on page 136: &lt;nodes&gt; is not shown in the EXTERNAL-IP
I have the same problem. I just see "none" and not "nodes" Also there was no warning of firewall rules.
tempusfugit (139) [Avatar] Offline
#3
Question on page 136: &lt;nodes&gt; is not shown in the EXTERNAL-IP
It just seems to be something that minikube does right now. minikube also doesn't seem to list an "ExternalIP" for the node. But the demonstration still works.

File: kubia-svc-nodeport.yaml
apiVersion: v1
kind: Service
metadata:
  name: kubia-nodeport
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 8080
      nodePort: 30123
  selector:
    app: kubia


File: kubia-replicaset.yaml
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: kubia
spec:
  replicas: 3
  selector:
    matchLabels:
      app: kubia
  template:
    metadata:
      labels:
        app: kubia
    spec:
      containers:
      - name: kubia
        image: kubia:v1
  • macOS High Sierra Version 10.13.5 (17F77)
  • Docker Version 18.06.1-ce-mac73 (26764) "Stable"

  • Session:
    $ open --background -a Docker
    $ minikube start --vm-driver=hyperkit
      Starting local Kubernetes v1.10.0 cluster...
      Starting VM...
      Getting VM IP address...
      Moving files into cluster...
      Setting up certs...
      Connecting to cluster...
      Setting up kubeconfig...
      Starting cluster components...
      Kubectl is now configured to use the cluster.
      Loading cached images from config file.
    $ eval $(minikube docker-env)
    $ minikube version
      minikube version: v0.28.2
    $ kubectl version
      Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-08T16:31:10Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"darwin/amd64"}
      Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
    $ kubectl api-resources
      NAME                              SHORTNAMES   APIGROUP                       NAMESPACED   KIND
      bindings                                                                      true         Binding
      componentstatuses                 cs                                          false        ComponentStatus
      configmaps                        cm                                          true         ConfigMap
      endpoints                         ep                                          true         Endpoints
      events                            ev                                          true         Event
      limitranges                       limits                                      true         LimitRange
      namespaces                        ns                                          false        Namespace
      nodes                             no                                          false        Node
      persistentvolumeclaims            pvc                                         true         PersistentVolumeClaim
      persistentvolumes                 pv                                          false        PersistentVolume
      pods                              po                                          true         Pod
      podtemplates                                                                  true         PodTemplate
      replicationcontrollers            rc                                          true         ReplicationController
      resourcequotas                    quota                                       true         ResourceQuota
      secrets                                                                       true         Secret
      serviceaccounts                   sa                                          true         ServiceAccount
      services                          svc                                         true         Service
      mutatingwebhookconfigurations                  admissionregistration.k8s.io   false        MutatingWebhookConfiguration
      validatingwebhookconfigurations                admissionregistration.k8s.io   false        ValidatingWebhookConfiguration
      customresourcedefinitions         crd,crds     apiextensions.k8s.io           false        CustomResourceDefinition
      apiservices                                    apiregistration.k8s.io         false        APIService
      controllerrevisions                            apps                           true         ControllerRevision
      daemonsets                        ds           apps                           true         DaemonSet
      deployments                       deploy       apps                           true         Deployment
      replicasets                       rs           apps                           true         ReplicaSet
      statefulsets                      sts          apps                           true         StatefulSet
      tokenreviews                                   authentication.k8s.io          false        TokenReview
      localsubjectaccessreviews                      authorization.k8s.io           true         LocalSubjectAccessReview
      selfsubjectaccessreviews                       authorization.k8s.io           false        SelfSubjectAccessReview
      selfsubjectrulesreviews                        authorization.k8s.io           false        SelfSubjectRulesReview
      subjectaccessreviews                           authorization.k8s.io           false        SubjectAccessReview
      horizontalpodautoscalers          hpa          autoscaling                    true         HorizontalPodAutoscaler
      cronjobs                          cj           batch                          true         CronJob
      jobs                                           batch                          true         Job
      certificatesigningrequests        csr          certificates.k8s.io            false        CertificateSigningRequest
      events                            ev           events.k8s.io                  true         Event
      daemonsets                        ds           extensions                     true         DaemonSet
      deployments                       deploy       extensions                     true         Deployment
      ingresses                         ing          extensions                     true         Ingress
      networkpolicies                   netpol       extensions                     true         NetworkPolicy
      podsecuritypolicies               psp          extensions                     false        PodSecurityPolicy
      replicasets                       rs           extensions                     true         ReplicaSet
      networkpolicies                   netpol       networking.k8s.io              true         NetworkPolicy
      poddisruptionbudgets              pdb          policy                         true         PodDisruptionBudget
      podsecuritypolicies               psp          policy                         false        PodSecurityPolicy
      clusterrolebindings                            rbac.authorization.k8s.io      false        ClusterRoleBinding
      clusterroles                                   rbac.authorization.k8s.io      false        ClusterRole
      rolebindings                                   rbac.authorization.k8s.io      true         RoleBinding
      roles                                          rbac.authorization.k8s.io      true         Role
      storageclasses                    sc           storage.k8s.io                 false        StorageClass
      volumeattachments                              storage.k8s.io                 false        VolumeAttachment
    $ kubectl create -f kubia-replicaset.yaml
      replicaset.apps/kubia created
    $ kubectl get rs
      NAME      DESIRED   CURRENT   READY     AGE
      kubia     3         3         3         9s
    $ kubectl describe rs
      Name:         kubia
      Namespace:    default
      Selector:     app=kubia
      Labels:       app=kubia
      Annotations:  <none>
      Replicas:     3 current / 3 desired
      Pods Status:  3 Running / 0 Waiting / 0 Succeeded / 0 Failed
      Pod Template:
        Labels:  app=kubia
        Containers:
         kubia:
          Image:        kubia:v1
          Port:         <none>
          Host Port:    <none>
          Environment:  <none>
          Mounts:       <none>
        Volumes:        <none>
      Events:
        Type    Reason            Age   From                   Message
        ----    ------            ----  ----                   -------
        Normal  SuccessfulCreate  19s   replicaset-controller  Created pod: kubia-6w8bb
        Normal  SuccessfulCreate  19s   replicaset-controller  Created pod: kubia-rl9hh
        Normal  SuccessfulCreate  19s   replicaset-controller  Created pod: kubia-clthl
    $ kubectl create -f kubia-svc-nodeport.yaml
      service/kubia-nodeport created
    $ kubectl describe svc kubia-nodeport
      Name:                     kubia-nodeport
      Namespace:                default
      Labels:                   <none>
      Annotations:              <none>
      Selector:                 app=kubia
      Type:                     NodePort
      IP:                       10.104.14.171
      Port:                     <unset>  80/TCP
      TargetPort:               8080/TCP
      NodePort:                 <unset>  30123/TCP
      Endpoints:                172.17.0.4:8080,172.17.0.5:8080,172.17.0.6:8080
      Session Affinity:         None
      External Traffic Policy:  Cluster
      Events:                   <none>
    $ kubectl get svc
      NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
      kubernetes       ClusterIP   10.96.0.1       <none>        443/TCP        12m
      kubia-nodeport   NodePort    10.104.14.171   <none>        80:30123/TCP   48s
    $ kubectl get po --selector="app=kubia" --output=wide
      NAME          READY     STATUS    RESTARTS   AGE       IP           NODE
      kubia-6w8bb   1/1       Running   0          2m        172.17.0.4   minikube
      kubia-clthl   1/1       Running   0          2m        172.17.0.6   minikube
      kubia-rl9hh   1/1       Running   0          2m        172.17.0.5   minikube
    $ kubectl get no -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'
    $ kubectl get no -o jsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}'
      192.168.64.2
    $ kubectl cluster-info
      Kubernetes master is running at https://192.168.64.2:8443
      KubeDNS is running at https://192.168.64.2:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    
      To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
    $ minikube ip
      192.168.64.2
    $ export KUBIA_URL=$(minikube service kubia-nodeport --url)
    $ echo $KUBIA_URL
      http://192.168.64.2:30123
    $ curl $KUBIA_URL
      You've hit kubia-clthl
    $ curl $KUBIA_URL
      You've hit kubia-6w8bb
    $ curl $KUBIA_URL
      You've hit kubia-rl9hh
    $ kubectl delete svc kubia-nodeport
      service "kubia-nodeport" deleted
    $ kubectl delete rs --all
      replicaset.extensions "kubia" deleted
    $ kubectl delete all --all
      pod "kubia-6w8bb" deleted
      pod "kubia-clthl" deleted
      pod "kubia-rl9hh" deleted
      service "kubernetes" deleted
    $ eval $(minikube docker-env --unset)
    $ minikube stop
      Stopping local Kubernetes cluster...
      Machine stopped.
    $ osascript -e 'quit app "Docker"'
    $
    


    Kubernetes: Use a Service to Access an Application in a Cluster