Posts

Showing posts from April, 2023

Kubernetes NodePort vs LoadBalancer vs Ingress?

Image
  ClusterIP A ClusterIP service is the default Kubernetes service. It gives you a service inside your cluster that other apps inside your cluster can access. There is no external access. The YAML for a ClusterIP service looks like this: apiVersion: v1 kind: Service metadata:     name: my-internal-service spec:   selector:         app: my-app   type: ClusterIP   ports:     - name: http     port: 80     targetPort: 80     protocol: TCP Start the Kubernetes Proxy: $ kubectl proxy --port=8080 Now, you can navigate through the Kubernetes API to access this service using this scheme: http://localhost:8080/api/v1/proxy/namespaces/<NAMESPACE>/services/<SERVICE-NAME>:<PORT-NAME>/ So to access the service we defined above, you could use the following address: http://localhost:8080/api/v1/proxy/namespaces/default/services/my-internal-service:http/ NodePort A NodePort service is the most primitive way to get external traffic directly to your service. NodePort, as the name implies