我已经使用两个Azure Ubuntu VM创建了Kubernetes群集。我能够使用Nodeport服务类型部署和访问Pod和部署。我还检查了Kube-system
名称空间中pod的状态。窗格的所有状态均显示为running
。但是,每当我向Loadbalancer提及服务类型时,它都没有创建LoadBalancer IP,并且其状态始终显示为pending
。在初始化Kubernetes主机时,我正在使用以下命令。
kubeadm init
下面是部署和svc清单文件。
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
type: LoadBalancer
kubectl describe svc nginx
Name: nginx
Namespace: default
Labels: app=nginx
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"service.beta.kubernetes.io/aws-load-balancer-type":"nlb"},"labels":{"app":...
service.beta.kubernetes.io/aws-load-balancer-type: nlb
Selector: app=nginx
Type: LoadBalancer
IP: 10.96.152.117
Port: http 80/TCP
TargetPort: 80/TCP
NodePort: http 32312/TCP
Endpoints: 10.44.0.5:80,10.44.0.6:80,10.44.0.7:80
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
在初始化kubeadm初始化时,我们是否需要提及VM的任何IP范围(私有或公共)?要么我们是否需要更改Azure Ubuntu VM中的任何网络设置?