taikun.cloud

Taikun Help Center

Kubernetes services

Kubernetes Services are Kubernetes resources that help network and communicate between different parts of an application deployed in a Kubernetes cluster. With Services, you get a stable IP address and DNS name that make accessing your application or component easy, no matter which Pod it’s running on. Services also help distribute traffic evenly across multiple Pods, ensuring no single Pod gets overwhelmed with requests.

Kubernetes Services are essential for several reasons:

  1. Networking: Kubernetes Services provide a networking layer that allows different components and applications deployed in a Kubernetes cluster to communicate with each other. By using Services, developers can abstract away the complexity of networking and focus on building their applications.
  2. Load balancing: Services can distribute traffic across multiple Pods, ensuring no single Pod gets overwhelmed with requests. This makes it easier to scale your application and handle high-traffic loads.
  3. High availability: Services provide a stable IP address and DNS name, ensuring your application is always available, even if one or more Pods fail.
  4. Microservices architecture: Services are a crucial component of microservices architecture, a popular approach to building modern, scalable applications. With Services, developers can develop and deploy microservices independently and then use Services to connect them.

Kubernetes Services are essential for building modern, scalable and highly available applications in a Kubernetes cluster. By providing a simple and flexible networking layer, Services help developers focus on building great applications without worrying about the underlying infrastructure.

Service Types

  • ClusterIP: By default, Kubernetes assigns a service type called ClusterIP to provide a fixed IP address for a group of pods within a cluster. This IP address is only accessible from within the cluster and cannot be accessed from outside the network. The unique IP address assigned by Kubernetes helps route traffic to the pods that are part of the service, ensuring that requests are directed to the correct destination. ClusterIP is a way for services and pods within the same Kubernetes cluster to communicate using a stable and reliable IP address.


selector:
    app.kubernetes.io/instance: wordpress
    app.kubernetes.io/name: wordpress
  clusterIP: 10.233.23.65
  clusterIPs:
    - 10.233.23.65
  type: ClusterIP
  sessionAffinity: None
  externalTrafficPolicy: Cluster

ClusterIP Manifest

  • LoadBalancer: The Load Balancer helps distribute incoming network traffic among pods providing the same service. It assigns a stable IP address and DNS name to this group of pods, ensuring that the service remains accessible even if individual pods fail or are replaced. By evenly distributing traffic among the pods, the Load Balancer improves the scalability and availability of Kubernetes applications, making them more reliable and efficient. This kind of service is typically used when you want to expose an application to clients outside your organization. You can find more details about Load Balancer here.
 
selector:
    app.kubernetes.io/component: primary
    app.kubernetes.io/instance: mariadb-1
    app.kubernetes.io/name: mariadb
  clusterIP: 10.233.12.155
  clusterIPs:
    - 10.233.12.155
  type: LoadBalancer
  sessionAffinity: None
  externalTrafficPolicy: Cluster

LoadBalancer Manifest

  • NodePort: NodePort allows you to expose a set of pods to the outside world. When you create a NodePort service, Kubernetes assigns a specific port on each node in the cluster that can be used to access the pods in the service, typically in the range of 30000 to 32767. The service can be accessed from outside the cluster by accessing the node’s IP address and the assigned port. This designated port is then used to route traffic to the pods that are part of the service, so when a request is made to the assigned port on any node in the cluster, it is forwarded to the corresponding pod, allowing the service to be accessed from outside the cluster.
 
 selector:
    app: MyApp
  clusterIP: 10.233.30.173
  clusterIPs:
    - 10.233.30.173
  type: NodePort
  sessionAffinity: None
  externalTrafficPolicy: Cluster

NodePort Manifest

  • ExternalName: ExternalName can be used as an alias for an external service that exists outside of the Kubernetes cluster. This means that instead of managing a set of pods, the ExternalName service maps the service name to an external DNS name. When a request is made to the ExternalName service, it returns the external DNS name, allowing the client to connect directly to the external service. It’s important to note that the ExternalName service does not provide any load balancing or routing functionality, nor does it have any selectors or endpoints associated with it. Its sole purpose is to act as a mapping between the Kubernetes service name and the external DNS name.
selector:
    app.kubernetes.io/instance: cassandra-1
    app.kubernetes.io/name: cassandra
  clusterIP: 10.233.37.190
  clusterIPs:
    - 10.233.37.190
  type: ExternalName
  externalName: my.database.example.com
  sessionAffinity: None

ExternalName Manifest

Taikun provides an intuitive and user-friendly interface that makes it easy to view all of the services running in your cluster. You can quickly access your cluster’s “k8s information” and view a list of all the services that are currently running.