8.7.4. Create a service to connect with SSH
You can create a service for a virtual machine (VM) and connect to the IP address and port exposed by the service. Services provide excellent performance and are recommended for applications that are accessed from outside the cluster or within the cluster. Ingress traffic is protected by firewalls.
After you create a service with virtctl, you must add special: key to the spec.template.metadata.labels stanza of the VirtualMachine manifest. If the cluster network cannot handle the traffic load, consider using a secondary network for VM access.
8.7.4.1. Service types for VM network access 링크 복사링크가 클립보드에 복사되었습니다!
A Kubernetes service exposes an application running on a set of pods to network clients. Services provide abstraction and load balancing, and the NodePort and LoadBalancer types also expose the application outside the cluster.
ClusterIP-
Exposes the service on an internal IP address and as a DNS name to other applications within the cluster. A single service can map to multiple virtual machines. When a client tries to connect to the service, the client’s request is load balanced among available backends.
ClusterIPis the default service type. NodePort-
Exposes the service on the same port of each selected node in the cluster.
NodePortmakes a port accessible from outside the cluster, provided that the node itself is externally accessible to the client. LoadBalancer- Creates an external load balancer in the current cloud (if supported) and assigns a fixed, external IP address to the service.
For on-premise clusters, you can configure a load balancing service by deploying the MetalLB Operator.