查看“︁K3sk8s基础”︁的源代码
←
K3sk8s基础
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
[[category:k8s]] <pre> apps bash 03-test-deploy.sh >>> 1. 部署测试应用 (2个副本的 nginx demo + Service + Ingress) deployment.apps/hello-web unchanged service/hello-web-svc unchanged ingress.networking.k8s.io/hello-web-ingress unchanged >>> 2. 等待 Pod 就绪... pod/hello-web-784668b86c-5gzqh condition met pod/hello-web-784668b86c-c7zmw condition met >>> 3. 查看资源状态 --- Pods --- NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES hello-web-784668b86c-5gzqh 1/1 Running 0 9m37s 10.42.2.118 k3s-agent-01 <none> <none> hello-web-784668b86c-c7zmw 1/1 Running 0 9m37s 10.42.4.43 k3s-agent-02 <none> <none> --- Service --- NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE hello-web-svc ClusterIP 10.43.179.173 <none> 80/TCP 12m --- Ingress --- NAME CLASS HOSTS ADDRESS PORTS AGE hello-web-ingress <none> hello.local.test 192.168.10.190,192.168.10.201,192.168.10.202 80 12m ========================================== ✅ 部署完成,验证请求链路: ========================================== 方式一 (推荐,直接用 curl 带 Host 头,不用改 /etc/hosts): curl -H 'Host: hello.local.test' http://192.168.10.105 方式二 (改 /etc/hosts 后浏览器访问): echo '192.168.10.105 hello.local.test' | sudo tee -a /etc/hosts 然后浏览器打开 http://hello.local.test 多请求几次,观察返回的 hostname 是否在两个 Pod 之间切换 (验证负载均衡): for i in {1..5}; do curl -s -H 'Host: hello.local.test' http://192.168.10.105 | grep -i 'Server name'; done 清理测试应用: kubectl delete -f test-app.yaml </pre> =troubleshooting= <pre> kubectl get nodes E0806 21:32:03.023568 157431 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com/api?timeout=32s\": dial tcp: lookup 920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com on 192.168.10.1:53: no such host" E0806 21:32:03.031828 157431 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com/api?timeout=32s\": dial tcp: lookup 920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com on 192.168.10.1:53: no such host" E0806 21:32:03.039270 157431 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com/api?timeout=32s\": dial tcp: lookup 920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com on 192.168.10.1:53: no such host" E0806 21:32:03.048542 157431 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com/api?timeout=32s\": dial tcp: lookup 920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com on 192.168.10.1:53: no such host" E0806 21:32:03.056331 157431 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com/api?timeout=32s\": dial tcp: lookup 920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com on 192.168.10.1:53: no such host" Unable to connect to the server: dial tcp: lookup 920376B3099E1023583D1077A6BC83E5.gr7.ap-east-1.eks.amazonaws.com on 192.168.10.1:53: no such host ➜ ~ kubectl config use-context default Switched to context "default". ➜ ~ kubectl get nodes NAME STATUS ROLES AGE VERSION debian-k3s-00 NotReady <none> 33d v1.36.2+k3s1 k3s-agent-01 Ready <none> 31d v1.36.2+k3s1 k3s-agent-02 Ready <none> 31d v1.36.2+k3s1 myxps Ready control-plane 35d v1.36.2+k3s1 </pre> dockerproxy.com 不能用了
返回
K3sk8s基础
。
导航菜单
个人工具
登录
命名空间
页面
讨论
大陆简体
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
我的导航
关于我
shell
python
ops
linuxchina.net
blog.linuxchina
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息