
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
这是一个基于Python和Flask的简单Web服务镜像,用于在Docker、Kubernetes或OpenShift环境中快速验证集群运行状态,是新集群部署后的入门测试工具。该镜像基于nicolaka/netshoot(一款Docker/Kubernetes网络调试工具集合)构建,内置丰富的网络工具,可用于排查容器及集群网络问题。
bashpython -m venv venv source venv/bin/activate pip install --requirement requirements.txt export FLASK_APP="app.py" export FLASK_ENV="development" export FLASK_RUN_HOST="0.0.0.0" flask run curl -s http://localhost:5000/
本地构建并运行
bashdocker build -t hello-kubernetes . docker run -it --rm \ --name hello \ --publish 5000:5000 \ hello-kubernetes curl -s http://localhost:5000/
使用DockerHub镜像运行
bashdocker run -it --rm \ --name hello \ --publish 5000:5000 \ docker.io/etoews/hello-kubernetes:latest curl -s http://localhost:5000/
Docker容器调试
bashdocker exec -it hello bash
本地Kubernetes运行(使用DockerHub镜像)
bashkubectl create namespace world kubectl apply -f manifests/kubernetes/deployment.yaml -n world kubectl apply -f manifests/kubernetes/service.yaml -n world watch kubectl get all -n world curl -s http://localhost:5000/ kubectl delete namespace world
说明:在Docker Desktop Kubernetes环境中使用type: LoadBalancer可直接访问服务。
远程Kubernetes运行(使用DockerHub镜像)
bashkubectl create namespace world kubectl apply -f manifests/kubernetes/deployment.yaml -n world kubectl apply -f manifests/kubernetes/service.yaml -n world watch kubectl get all -n world hello_host=$(kubectl get service hello -o jsonpath="{.status.loadBalancer.ingress[*].hostname}" -n world) curl -s http://${hello_host}:5000/ kubectl delete namespace world
说明:删除命名空间时会同时清理背后的负载均衡实例(如EKS的ELB),需等待几分钟完成。
Kubernetes网络调试
参考https://hub.docker.com/r/nicolaka/netshoot%E4%BA%86%E8%A7%A3%E5%86%85%E7%BD%AE%E5%B7%A5%E5%85%B7%E3%80%82
bashhello_pod_0=$(kubectl get pods -o jsonpath="{.items[0].metadata.name}" -n world) kubectl exec -it ${hello_pod_0} -n world bash curl -s https://icanhazip.com
OpenShift 4远程运行(使用DockerHub镜像)
bashoc new-project world oc process -o yaml -f manifests/openshift4/deployment.yaml \ --param IMAGE='docker.io/etoews/hello-kubernetes:latest' \ | oc apply -f - oc apply -f manifests/openshift4/service.yaml oc apply -f manifests/openshift4/route.yaml watch oc get all hello_host=$(oc get route hello --no-headers -o=custom-columns=HOST:.spec.host) curl http://${hello_host}/ oc delete project world
OpenShift 4远程构建并运行
bashoc new-project world oc apply -f manifests/openshift4/imagestream.yaml oc apply -f manifests/openshift4/buildconfig.yaml oc start-build hello watch oc get all oc process -o yaml -f manifests/openshift4/deployment.yaml \ --param IMAGE='image-registry.openshift-image-registry.svc:5000/world/hello:latest' \ | oc apply -f - oc apply -f manifests/openshift4/service.yaml oc apply -f manifests/openshift4/route.yaml watch oc get all hello_host=$(oc get route hello --no-headers -o=custom-columns=HOST:.spec.host) curl http://${hello_host}/ oc delete project world
OpenShift 4网络调试
参考https://hub.docker.com/r/nicolaka/netshoot%E4%BA%86%E8%A7%A3%E5%86%85%E7%BD%AE%E5%B7%A5%E5%85%B7%E3%80%82
bashhello_pod_0=$(oc get pods --selector app=hello -o jsonpath="{.items[0].metadata.name}") oc rsh ${hello_pod_0} curl -s https://icanhazip.com
使用GitHub提交哈希作为镜像标签运行特定版本:
bashdocker run -it --rm \ --name hello \ --publish 5000:5000 \ docker.io/etoews/hello-kubernetes:b262b385143f***d5dbe201b999ded7782087a curl -s http://localhost:5000/
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务