Ubuntu 24.04.2部署k8s 1.37.0集群
1、Ubuntu 24.04.2安装k8s 1.37.0
软件版本:
ubuntu24.04.2,
kubeadm v1.37.0
kubernetes v 1.37.0
containerd 2.2.3
cilium version v1.19.1
机器 地址 系统
node1 192.168.2.21 Ubuntu 24.04.2 LTS master
node2 192.168.2.22 Ubuntu 24.04.2 LTS node
node3 192.168.2.23 Ubuntu 24.04.2 LTS node
node4 192.168.2.24 Ubuntu 24.04.2 LTS node
第一步、基础设置
所有机器均需要操作
关闭swap
sed -ri 's/^([^#].*swap.*)$/#\1/' /etc/fstab && grep swap /etc/fstab && swapoff -a && free -h
关闭防火墙
ufw disable
设置时区
timedatectl set-timezone Asia/Shanghai
systemctl restart systemd-timesyncd.service
开启ipv4转发
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
# Kubernetes & Cilium 必需参数
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
# 可选:调优内核参数(如连接跟踪表大小)
net.netfilter.nf_conntrack_max = 1048576
EOF
应用配置(等效于 sysctl -p /etc/sysctl.d/k8s.conf)
sysctl --system
sysctl net.ipv4.ip_forward
配置hostname以及hosts
cat >> /etc/hosts << EOF
192.168.2.21 ops-test-021
192.168.2.22 ops-test-022
192.168.2.23 ops-test-023
192.168.2.24 ops-test-024
192.168.2.25 ops-test-025
192.168.2.26 ops-test-026
EOF
第二步:安装containerd
所有节点均需操作
2.1 下载和配置containerd
从 https://github.com/containerd/containerd/releases 下载
wget https://github.com/containerd/containerd/releases/download/v2.2.3/containerd-2.2.3-linux-amd64.tar.gz
tar xvf containerd-2.2.3-linux-amd64.tar.gz
mv bin/* /usr/local/bin/
mkdir -p /etc/containerd && containerd config default > /etc/containerd/config.toml
apt install runc
sed -i "s#registry.k8s.io/pause:3.10.1#registry.aliyuncs.com/google_containers/pause:3.10.2#g" /etc/containerd/config.toml
#添加SystemdCgroup = true参数
sed -i "/ShimCgroup = ''/a \ SystemdCgroup = true" /etc/containerd/config.toml
#安装containerd.service官网提供的
cat > /usr/lib/systemd/system/containerd.service <<EOF
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target dbus.service
[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd
Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
OOMScoreAdjust=-999
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now containerd
systemctl status containerd.service
2.2 安装crictl
CRICTL_VERSION=v1.35.0
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$CRICTL_VERSION/crictl-$CRICTL_VERSION-linux-amd64.tar.gz
tar zxvf crictl-$CRICTL_VERSION-linux-amd64.tar.gz -C /usr/local/bin
2.3 配置私有Harbor镜像仓库
修改配置
大概在52行开始
vim +52 /etc/containerd/config.toml
51 [plugins.'io.containerd.cri.v1.images'.registry]
52 config_path = '/etc/containerd/certs.d' #修改该行的配置信息
重新启动containerd
第三步:安装K8S组件
更新源
sudo apt update && sudo apt upgrade -y
安装工具
apt install -y apt-transport-https ca-certificates curl gpg
创建目录,有的版本有,看情况创建
mkdir -p -m 755 /etc/apt/keyrings
下载秘钥
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.37/deb/Release.key | \
sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg && \
sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg
添加软件源1.37
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.37/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
更新,安装软件,防止更新
apt update && \
apt install kubelet kubectl kubeadm && \
apt-mark hold kubelet kubeadm kubectl
设置开机自启
systemctl enable --now kubelet
查看版本
kubeadm version
root@ops-test-021:~# kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"36", EmulationMajor:"", EmulationMinor:"", MinCompatibilityMajor:"", MinCompatibilityMinor:"", GitVersion:"v1.37.0 ", GitCommit:"ecf6decece6a6de25a57aad9ba90b6ce580f6f78", GitTreeState:"clean", BuildDate:"2026-04-22T13:54:03Z", GoVersion:"go1.26.2", Compiler:"gc", Platform:"linux/amd64"}
第四步:初始化集群
4.1 下载相关镜像
先下载阿里云镜像,node1节点即可,即master节点
sudo kubeadm config images pull \
--image-repository=registry.aliyuncs.com/google_containers \
--kubernetes-version=v1.37.0 \
--cri-socket=unix:///run/containerd/containerd.sock
root@ops-test-021:~# sudo kubeadm config images pull \
--image-repository=registry.aliyuncs.com/google_containers \
--kubernetes-version=v1.37.0 \
--cri-socket=unix:///run/containerd/containerd.sock
[config/images] Pulled registry.aliyuncs.com/google_containers/kube-apiserver:v1.37.0
[config/images] Pulled registry.aliyuncs.com/google_containers/kube-controller-manager:v1.37.0
[config/images] Pulled registry.aliyuncs.com/google_containers/kube-scheduler:v1.37.0
[config/images] Pulled registry.aliyuncs.com/google_containers/kube-proxy:v1.37.0
[config/images] Pulled registry.aliyuncs.com/google_containers/coredns:v1.13.1
[config/images] Pulled registry.aliyuncs.com/google_containers/pause:3.10.1
[config/images] Pulled registry.aliyuncs.com/google_containers/etcd:3.6.6-0
root@ops-test-021:~#
4.2 在master节点生成初始化集群的配置文件
kubeadm config print init-defaults > kubeadm-config.yaml
4.3 配置文件需要修改如下内容
修改kubeadm-config配置文件
vim kubeadm-config.yaml
# 管理节点的IP地址
advertiseAddress: 192.168.2.21
# 本机注册到集群后的节点名称
name: ops-test-021
#版本
kubernetesVersion: 1.37.0
#跳过kube-proxy 这装
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
imagePullPolicy: IfNotPresent
imagePullSerial: true
name: ops-test-021
taints: null
skipPhases: # 添加在这里
- addon/kube-proxy # 关键:跳过 kube-proxy 安装,如果此处不加跳过配置也可以在初始化的时候加上--skip-phases=addon/kube-proxy
timeouts:
--增加如上两行
#在 networking 部分添加 podSubnet(必须与后续 Cilium 的 ipv4NativeRoutingCIDR 一致)
networking:
dnsDomain: cluster.local
serviceSubnet: 10.96.0.0/12
podSubnet: 10.244.0.0/16 # 新增此行
# 集群镜像下载地址,修改为阿里云
imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers
4.4 通过配置文件初始化集群
kubeadm init --config kubeadm-config.yaml
备用方式:
kubeadm init --config kubeadm-init.yaml --upload-certs --skip-phases=addon/kube-proxy
—执行结果-----
root@ops-test-021:~# kubeadm init --config kubeadm-config.yaml
[init] Using Kubernetes version: v1.37.0
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action beforehand using 'kubeadm config images pull'
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local ops-test-021] and IPs [10.96.0.1 192.168.2.21]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [localhost ops-test-021] and IPs [192.168.2.21 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [localhost ops-test-021] and IPs [192.168.2.21 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "super-admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/instance-config.yaml"
[patches] Applied patch of type "application/strategic-merge-patch+json" to target "kubeletconfiguration"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests"
[kubelet-check] Waiting for a healthy kubelet at http://127.0.0.1:10248/healthz. This can take up to 4m0s
[kubelet-check] The kubelet is healthy after 502.688908ms
[control-plane-check] Waiting for healthy control plane components. This can take up to 4m0s
[control-plane-check] Checking kube-apiserver at https://192.168.2.21:6443/livez
[control-plane-check] Checking kube-controller-manager at https://127.0.0.1:10257/healthz
[control-plane-check] Checking kube-scheduler at https://127.0.0.1:10259/livez
[control-plane-check] kube-controller-manager is healthy after 3.510868375s
[control-plane-check] kube-scheduler is healthy after 6.292315297s
[control-plane-check] kube-apiserver is healthy after 8.503774485s
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node ops-test-021 as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node ops-test-021 as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
[bootstrap-token] Using token: abcdef.0123456789abcdef
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.2.21:6443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:4da5d60cfb7bdfdf47ed5077ba954b724381acc2f015cf2daaf1f9f361581892
4.5 据集群初始化后的提示,执行如下命令
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
4.6 其它节点加入集群
root@ops-test-022:~# kubeadm join 192.168.2.21:6443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:4da5d60cfb7bdfdf47ed5077ba954b724381acc2f015cf2daaf1f9f361581892
[preflight] Running pre-flight checks
[preflight] Reading configuration from the "kubeadm-config" ConfigMap in namespace "kube-system"...
[preflight] Use 'kubeadm init phase upload-config kubeadm --config your-config-file' to re-upload it.
W0506 17:14:58.657575 2328 configset.go:77] Warning: No kubeproxy.config.k8s.io/v1alpha1 config is loaded. Continuing without it: configmaps "kube-proxy" is forbidden: User "system:bootstrap:abcdef" cannot get resource "configmaps" in API group "" in the namespace "kube-system"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/instance-config.yaml"
[patches] Applied patch of type "application/strategic-merge-patch+json" to target "kubeletconfiguration"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-check] Waiting for a healthy kubelet at http://127.0.0.1:10248/healthz. This can take up to 4m0s
[kubelet-check] The kubelet is healthy after 502.053095ms
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
查看集群状态
root@ops-test-021:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
ops-test-021 NotReady control-plane 13m v1.37.0
ops-test-022 NotReady <none> 8m25s v1.37.0
ops-test-023 NotReady <none> 12s v1.37.0
#验证节点 PodCIDR 分配
root@ops-test-021:~# kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.podCIDR}{"\n"}{end}'
ops-test-021 10.244.0.0/24
ops-test-022 10.244.1.0/24
ops-test-023 10.244.2.0/24
4.7 部署Cilium工具
4.7.1. 安装 Cilium CLI 工具
curl -L --remote-name https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz
tar xzvf cilium-linux-amd64.tar.gz
sudo mv cilium /usr/local/bin
验证:
cilium version
4.7.2. 配置安装
先安装 Gateway API CRD(必须先做)
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.3.0/standard-install.yaml
查看ReferenceGrant 状态
kubectl api-resources | grep ReferenceGrant
root@ops-test-021:~# kubectl api-resources | grep ReferenceGrant
referencegrants refgrant gateway.networking.k8s.io/v1beta1 true ReferenceGrant
安装
cilium install \
--version 1.19.1 \
\
--set kubeProxyReplacement=true \
--set kubeProxyReplacementMode=strict \
\
--set k8sServiceHost=192.168.2.21 \
--set k8sServicePort=6443 \
\
--set routingMode=native \
--set ipam.mode=kubernetes \
--set autoDirectNodeRoutes=true \
--set ipv4NativeRoutingCIDR=10.244.0.0/16 \
\
--set loadBalancer.mode=snat \
\
--set nodePort.enabled=true \
--set externalIPs.enabled=true \
--set hostServices.enabled=true \
\
--set l2announcements.enabled=true \
\
--set gatewayAPI.enabled=true \
\
--set hubble.enabled=true \
--set hubble.relay.enabled=true \
--set hubble.ui.enabled=true \
\
--set prometheus.enabled=true \
--set operator.prometheus.enabled=true
执行结果-----
root@ops-test-021:~# cilium install \
--version 1.19.1 \
\
--set kubeProxyReplacement=true \
--set kubeProxyReplacementMode=strict \
\
--set k8sServiceHost=192.168.2.21 \
--set k8sServicePort=6443 \
\
--set routingMode=native \
--set ipam.mode=kubernetes \
--set autoDirectNodeRoutes=true \
--set ipv4NativeRoutingCIDR=10.244.0.0/16 \
\
--set loadBalancer.mode=snat \
\
--set nodePort.enabled=true \
--set externalIPs.enabled=true \
--set hostServices.enabled=true \
\
--set l2announcements.enabled=true \
\
--set gatewayAPI.enabled=true \
\
--set hubble.enabled=true \
--set hubble.relay.enabled=true \
--set hubble.ui.enabled=true \
\
--set prometheus.enabled=true \
--set operator.prometheus.enabled=true
ℹ️ Using Cilium version 1.19.1
🔮 Auto-detected cluster name: kubernetes
🔮 Auto-detected kube-proxy has not been installed
ℹ️ Cilium will fully replace all functionalities of kube-proxy
4.7.5 验证安装
cilium status
—验证结果
root@ops-test-021:~# kubectl get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system cilium-ctpgt 1/1 Running 0 13m
kube-system cilium-envoy-66c9g 1/1 Running 0 13m
kube-system cilium-envoy-x627q 1/1 Running 0 13m
kube-system cilium-envoy-xjj5h 1/1 Running 0 13m
kube-system cilium-k84df 1/1 Running 0 13m
kube-system cilium-operator-845ffffd57-6gpfn 1/1 Running 0 13m
kube-system cilium-w6bff 1/1 Running 0 13m
kube-system coredns-69f5d4fb89-4gfwc 1/1 Running 0 45m
kube-system coredns-69f5d4fb89-wwzxj 1/1 Running 0 45m
kube-system etcd-ops-test-021 1/1 Running 0 45m
kube-system hubble-relay-5d96b56dc8-dmqph 1/1 Running 0 13m
kube-system hubble-ui-6b4f8fcff9-8mqfn 2/2 Running 0 13m
kube-system kube-apiserver-ops-test-021 1/1 Running 0 45m
kube-system kube-controller-manager-ops-test-021 1/1 Running 0 45m
kube-system kube-scheduler-ops-test-021 1/1 Running 0 45m
root@ops-test-021:~# cilium status
/¯¯\
/¯¯\__/¯¯\ Cilium: OK
\__/¯¯\__/ Operator: OK
/¯¯\__/¯¯\ Envoy DaemonSet: OK
\__/¯¯\__/ Hubble Relay: OK
\__/ ClusterMesh: disabled
DaemonSet cilium Desired: 3, Ready: 3/3, Available: 3/3
DaemonSet cilium-envoy Desired: 3, Ready: 3/3, Available: 3/3
Deployment cilium-operator Desired: 1, Ready: 1/1, Available: 1/1
Deployment hubble-relay Desired: 1, Ready: 1/1, Available: 1/1
Deployment hubble-ui Desired: 1, Ready: 1/1, Available: 1/1
Containers: cilium Running: 3
cilium-envoy Running: 3
cilium-operator Running: 1
clustermesh-apiserver
hubble-relay Running: 1
hubble-ui Running: 1
Cluster Pods: 4/4 managed by Cilium
Helm chart version: 1.19.1
Image versions cilium quay.io/cilium/cilium:v1.19.1@sha256:41f1f74a0000de8656f1de4088ea00c8f2d49d6edea579034c73c5fd5fe01792: 3
cilium-envoy quay.io/cilium/cilium-envoy:v1.35.9-1770979049-232ed4a26881e4ab4f766f251f258ed424fff663@sha256:8188114a2768b5f49d6ce58e168b20d765e0fbc64eee0d83241aa2b150ccd788: 3
cilium-operator quay.io/cilium/operator-generic:v1.19.1@sha256:e7278d763e448bf6c184b0682cf98cdca078d58a27e1b2f3c906792670aa211a: 1
hubble-relay quay.io/cilium/hubble-relay:v1.19.1@sha256:d8c4e13bc36a56179292bb52bc6255379cb94cb873700d316ea3139b1bdb8165: 1
hubble-ui quay.io/cilium/hubble-ui-backend:v0.13.3@sha256:db1454e45dc39ca41fbf7cad31eec95d99e5b9949c39daaad0fa81ef29d56953: 1
hubble-ui quay.io/cilium/hubble-ui:v0.13.3@sha256:661d5de7050182d495c6497ff0b007a7a1e379648e60830dd68c4d78ae21761d: 1
root@ops-test-021:~#
查看状态
root@ops-test-021:~/gateway/vip# kubectl get gatewayclass
NAME CONTROLLER ACCEPTED AGE
cilium io.cilium/gateway-controller True 11m
4.7.6 hubble ui应用
在安装时已启用hubble-ui,现在配置暴露hubble的访问
#创建地址池
# cat lb-pool.yml
apiVersion: cilium.io/v2
kind: CiliumLoadBalancerIPPool
metadata:
name: gateway-pool
spec:
blocks:
- start: 192.168.2.24
stop: 192.168.2.24
# cat l2-polocy.yml
apiVersion: cilium.io/v2alpha1
kind: CiliumL2AnnouncementPolicy
metadata:
name: l2-policy
spec:
loadBalancerIPs: true
interfaces:
- ens160
创建gateway
# cat gateway_input.yml
apiVersion: v1
kind: Namespace
metadata:
name: infra
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: cilium-gw
namespace: infra
spec:
gatewayClassName: cilium
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
```
备注:要设置允许跨namespace访问
配置hubble httproute
#cat hubble-route.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: hubble-ui
namespace: kube-system
spec:
parentRefs:
- name: cilium-gw
namespace: infra
sectionName: http
hostnames:
- hubble.cctbb.com
rules:
-
matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: hubble-ui
port: 80
- path:
执行:
kubectl apply -f lb-pool.yml
kubectl apply -f l2-polocy.yml
kubectl apply -f gateway_input.yml
#查看gateway
```root@ops-test-021:~/gateway/vip# kubectl get gateway -A
NAMESPACE NAME CLASS ADDRESS PROGRAMMED AGE
infra cilium-gw cilium 192.168.2.24 True 21m
#查看Route 是否 Attached
root@ops-test-021:~/gateway/vip# kubectl get httproute -A
NAMESPACE NAME HOSTNAMES AGE
kube-system hubble-ui ["hubble.cctbb.com"] 13m
#Gateway Listener Attached Routes
root@ops-test-021:~/gateway/vip# kubectl describe gateway cilium-gw -n infra
Name: cilium-gw
Namespace: infra
Labels: <none>
Annotations: <none>
API Version: gateway.networking.k8s.io/v1
Kind: Gateway
Metadata:
Creation Timestamp: 2026-05-07T07:19:12Z
Generation: 1
Resource Version: 168849
UID: 532e61c3-26a1-44b0-8dc0-26f233ec2b54
Spec:
Gateway Class Name: cilium
Listeners:
Allowed Routes:
Namespaces:
From: All
Name: http
Port: 80
Protocol: HTTP
Status:
Addresses:
Type: IPAddress
Value: 192.168.2.24
Conditions:
Last Transition Time: 2026-05-07T07:19:12Z
Message: Gateway successfully scheduled
Observed Generation: 1
Reason: Accepted
Status: True
Type: Accepted
Last Transition Time: 2026-05-07T07:21:26Z
Message: Gateway Programmed
Observed Generation: 1
Reason: Programmed
Status: True
Type: Programmed
Listeners:
Attached Routes: 1
Conditions:
Last Transition Time: 2026-05-07T07:21:25Z
Message: Resolved Refs
Observed Generation: 1
Reason: ResolvedRefs
Status: True
Type: ResolvedRefs
Last Transition Time: 2026-05-07T07:21:25Z
Message: Listener Accepted
Observed Generation: 1
Reason: Accepted
Status: True
Type: Accepted
Last Transition Time: 2026-05-07T07:21:26Z
Message: Listener Programmed
Observed Generation: 1
Reason: Programmed
Status: True
Type: Programmed
Name: http
Supported Kinds:
Group: gateway.networking.k8s.io
Kind: HTTPRoute
Group: gateway.networking.k8s.io
Kind: GRPCRoute
Events: <none>
#查看gateway sevices
root@ops-test-021:~/gateway/vip# kubectl get svc -A | grep gateway
infra cilium-gateway-cilium-gw LoadBalancer 10.107.91.245 192.168.2.24 80:31386/TCP 19m
配置DNS解析
访问UI页面
http://hubble.cctbb.com
curl http://hubble.cctbb.com
<!doctype html>
更多推荐
所有评论(0)