Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

How to expose your Kubernetes app

Sumit Rawal answered on May 14, 2023 Popularity 5/10 Helpfulness 1/10

Contents


More Related Answers

  • set kubernetes alias
  • kubernetes clusterip service template
  • kubernetes deployment
  • kubectl create
  • kubectl config kubernetes dashboard
  • kubectl patch kubernetes
  • kubectl run create service
  • kubectl expose
  • install kubernetess on mac
  • how to expose external ip in kubernetes
  • Creating a kubernetes service cluster
  • What is a Kubernetes Service Account?
  • How to deploy a Kubernetes app
  • home kubernetes cluster ingress with private ip
  • deploy Kubernetes dashboard into the cluster
  • create service with endpoint kubernetes
  • kubernetes command kubectl
  • Why (and when) you should use Kubernetes
  • kubectl run create service
  • kubectl create deploy
  • kubernetes setup
  • kubernetes clusterip
  • Use Kubespray to deploy a Production Ready Kubernetes Cluster
  • kubernetes create issuer
  • run temporary container kubernetes
  • Kubernetes configuration
  • spring boot with kubernetes
  • Introducing Kubernetes runtime components
  • Kubernetes Tutorial: What you’ll need to get started
  • Exploring your Kubernetes app

  • How to expose your Kubernetes app

    0

    Up until now, our app has been fully isolated in our test environment. With real programs, you’ll almost always need to have your app send web requests to other outside web apps.

    To do this, we’ll use the expose command which will create a new service instance with the same name as our deployment and will automatically define the port configuration to allow a connection. As part of the command, we define which port the service should listen on. In this case, we’ll use port 8080.

    To try this yourself, enter:

    kubectl expose deployment hello-node --type=LoadBalancer --port=8080

    To see this service in action, we can once again enter:

    kubectl get svc

    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

    hello-node LoadBalancer 10.108.188.234 localhost 8080:32505/TCP 7s

    kubernetes ClusterIP 10.96.0.1 443/TCP 1h

    Here we see that where we once had only one service, we now have two, the original kubernetes and new service hello-node. Notice how the latter differs in both the EXTERNAL-IP and the PORT(S) field due to it being public. NodePorts are the published IP addresses for external users to access the services.

    Now that our app is exposed, we can access the web application running inside the hello-node pod to print a message.

    To do this, enter:

    curl http:///localhost:8080

    Hello World!

    And like that, we’ve called an external IP to execute our pod and had it print!

    Popularity 5/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 14 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.