To access the cluster from external network, on the first main node install the components: ingress-nginx and metallb.
To install the ingress-nginx component:
Execute the command:
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace
Install the ingressclass class by default:
kubectl annotate ingressclass nginx ingressclass.kubernetes.io/is-default-class='true'
After executing the operations, the ingress-nginx component is installed on the main node.
To install the metallb component:
Execute the command:
helm install metallb metallb/metallb -n metallb-system --create-namespace
Create the metalb-config.yaml file to access the cluster with contents:
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: first-pool
namespace: metallb-system
spec:
addresses:
- {<IP address master1>}/32
Specify in the file the list of IP addresses (for example, first-pool), at which the cluster will be available. If the list contains several IP addresses, they are placed vertically.
NOTE. Make sure that all IP addresses in the list are linked to interfaces on main nodes. The example uses one main node that is why the unique IP address is specified.
Apply the settings specified in the metalb-config.yaml file:
kubectl apply -f metalb-config.yaml
Check the list of IP addresses:
kubectl get IPAddressPools -n metallb-system
The response should contain the list with the specified IP addresses.
After executing the operations, the metallb component is installed on the main node.
See also:
Preparation and Deployment of Fault-Tolerant Cluster Based on Kubernetes | Setting Up Persistent Volume Storage Sections