Provide Users access to applications installed in their namespaces

4/1/2018

I need to create a k8s cluster with user having their own namespace and application installed in those namespace which they can access from a web-portal(e.g providing http://service_ip:service_port in case of jupyterhub) i am using helm charts to install applications and kind of confused with services types so i need your suggestion should i use nodeport or should i use clusterip and how i would discover and provide service url to users. any help would be appreciated.

-- captainchhala
kubernetes

1 Answer

4/1/2018

Steps

  1. Find the Service defined for the application.
  2. Expose the Service either via either NodePort, LoadBalancer, or Ingress.

Reference

The diagrams are from the book:


NodePort

If the client can access the nodes directly or via tunnel (VPN or SSH tunnel), the expose the service as NodePort type.

enter image description here

To do so, use kubectl expose or kubectl edit to change the spec.type.

Example:

apiVersion: v1
kind: Service
metadata:
  name: kubernetes-dashboard
  namespace: kube-system
spec:
  clusterIP: 10.100.96.203
  ports:
  - port: 443
    protocol: TCP
    targetPort: 8443
  selector:
    k8s-app: kubernetes-dashboard
  sessionAffinity: None
  type: ClusterIP              <----- Change to NodePort (or LoadBalancer)

LoadBalancer

If the K8S is running in AWS, Azure, GCE, for which the K8S cloud providers are supported, then the service can be exposed via the load balancer DNS or IP (can be via the public Internet too, depending on the access configuration on the LB). Change the service spec.type to LoadBalancer.

For AWS cloud provider, refer to K8S AWS Cloud Provider Notes.

enter image description here

Ingress

K8S ingress offers a way to access via hostname and TLS. Similar to OpenShift Route.

enter image description here

-- mon
Source: StackOverflow