Asking for help? Comment out what you need so we can get more information to help you!
Cluster information:
$ kubectl cluster-info
Kubernetes control plane is running at https://192.168.1.33:6443
CoreDNS is running at https://192.168.1.33:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Kubernetes version:
$ kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.1", GitCommit:"86ec240af8cbd1b60bcc4c03c20da9b98005b92e", GitTreeState:"clean", BuildDate:"2021-12-16T11:39:51Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}
Cloud being used: bare-metal
Installation method:
Install with kubeadm, kubectl and kubelet
Host OS:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
CNI and version: no idea
CRI and version: no idea
I’ve installed metalib for loadbalancer in my home server. I’m very new in kubernetes and still studying. According from official website metalib metalib can configure so my service to my pod can receive public ip address from router, but in my case my pod service can received ip address the same with ip address in my home LAN and I’ve spefied in metalib config file yml.
this is my all namespaces
kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default kubia 1/1 Running 0 16h
default nginx-example 1/1 Running 0 9m48s
kube-system coredns-64897985d-5gls4 1/1 Running 37 (73m ago) 22d
kube-system coredns-64897985d-jz87n 1/1 Running 38 (73m ago) 22d
kube-system etcd-ubuntu-server2 1/1 Running 40 (73m ago) 22d
kube-system kube-apiserver-ubuntu-server2 1/1 Running 85 22d
kube-system kube-controller-manager-ubuntu-server2 1/1 Running 92 (63m ago) 22d
kube-system kube-flannel-ds-4shht 1/1 Running 1 (2d14h ago) 2d17h
kube-system kube-flannel-ds-rm8ld 1/1 Running 36 (73m ago) 22d
kube-system kube-flannel-ds-v62tl 1/1 Running 7 (46h ago) 22d
kube-system kube-proxy-4hkfk 1/1 Running 35 (73m ago) 22d
kube-system kube-proxy-b5ndg 1/1 Running 1 (2d14h ago) 2d17h
kube-system kube-proxy-kc65w 1/1 Running 7 (46h ago) 22d
kube-system kube-scheduler-ubuntu-server2 1/1 Running 62 22d
metallb-system controller-7cf77c64fb-bnvc4 1/1 Running 0 28m
metallb-system speaker-4hvjl 1/1 Running 0 28m
metallb-system speaker-7bzkt 1/1 Running 0 28m
metallb-system speaker-bmkgd
and this is my node 1 master and 2 workers
kubectl get nodes
NAME STATUS ROLES AGE VERSION
ubuntu-cloud Ready <none> 22d v1.23.0
ubuntu-server1 Ready <none> 2d17h v1.23.1
ubuntu-server2 Ready control-plane,master 22d v1.23.1
This my all pods
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kubia 1/1 Running 0 16h 10.244.1.6 ubuntu-server1 <none> <none>
nginx-example 1/1 Running 0 32m 10.244.3.5 ubuntu-cloud <none> <none
This my pod services
kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 22d
kubia-http LoadBalancer 10.99.224.32 192.168.1.200 8080:32100/TCP 16h
nginx-example LoadBalancer 10.99.244.140 192.168.1.201 80:30080/TCP 32m
all run normally and my pod service can get ip address from metalib. Those IP address is the same subnet mask with my LAN IP address.
This is my metalib config yaml file:
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- 192.168.1.200-192.168.1.210
All function normally. I can access nginx from my lan with those port public my pod services. But when I try to use ip address given by metalib with those port I can’t access the web page, I also can’t ping ip address given by metalib.
But I can access those ip address given by metalib from my host os which installed kubernetes cluster. Example in my host os i can access with curl
curl 192.168.1.200:8080
You’ve hit kubia
and
curl 192.168.1.201
<html>
<head>
<title>Welcome to our server</title>
<style>
body{
font-family: Helvetica, Arial, sans-serif;
}
.message{
width:330px;
padding:20px 40px;
margin:0 auto;
background-color:#f9f9f9;
border:1px solid #ddd;
}
center{
margin:40px 0;
}
h1{
font-size: 18px;
line-height: 26px;
}
p{
font-size: 12px;
}
</style>
</head>
<body>
<div class="message">
<h1>Welcome to our server</h1>
<p>The website is currently being setup under this address.</p>
<p>For help and support, please contact: <a href="me@example.com">me@example.com</a></p>
</div>
</body>
</html>
The question is how to make my pod service can access directly using ip address given by metalib from my home LAN?
Thank You in Advance
Best regards,
Afiadi