With Portainer it is very easy to configure Services Types with your Applications in Kubernetes. Let's check how this is done for ClusterIP, NodePort and Load Balancer.
No Service Type
- Deploying an Applications with no Service Type associated to it is very simple by not assigning any ports to it:
ClusterIP Service Type
- When deploying and Application that requires a ClusterIP Service type you simply publish a port with the Internal publishing mode enabled:
NodePort Service Type
- When deploying and Application that requires a NodePort Service type you need to select the Cluster publishing mode and respective container+node ports required/used by the application:
Load Balancer Service Type
- When deploying and Application that requires a Load Balancer Service type you need to select the Load Balancer publishing mode and respective ports required or used by the application:
- In order to use the Load Balancer a plugin like MetalLB or similar has to be installed on your Kubernetes Cluster. You can then enable the Load Balancer via Portainer by:
- Opening you Cluster setup:
- Enabling the option in the Networking features of your Kubernetes cluster:
Ingress Service type
- When deploying and Application that requires an Ingress Service type you need to first create a Resource Pool with the Ingress configured:
- You can the deploy the Application with the Ingress option making sure to select the proper Resource Pool:
- Once the proper Resource Pool is selected the Ingress option will be available for the application:
- In order to use the Ingress Service type an Ingress controller like Nginx or Traefik has to be installed on your Kubernetes Cluster. You can then enable the Ingress Controller via Portainer by:
- Opening you Cluster setup:
- Enabling the option in the Networking features of your Kubernetes cluster:
Additional features via Portainer
Auto-Scaling
- Make sure the metrics server plugin or similar is installed on your Kubernetes Cluster.
- Enable the metrics server features via Portainer by opening you Cluster setup:
- Select the Enable features using metrics server under Resources and Metrics:
- When deploying an application you can select the auto scaling and respective minimum and maximum instances along with the Target CPU usage (%):
Placement Rules
- When deploying an application you can select the placement preferences under Placement preferences and constraints and configuring the rule or rules you need for you application:
- Make sure to select the Placement policy accordingly:
We have also recorded a how-to video to show this in action.