nginx - 运行没有 minikube 等的 kubernetes 容器
问题描述
我想在 kubernetes 的帮助下运行一个 nginx-server
kubectl run nginx-image --image nginx
但是抛出了错误:
error: Missing or incomplete configuration info. Please point to an existing, complete config file:
1. Via the command-line flag --kubeconfig
2. Via the KUBECONFIG environment variable
3. In your home directory as ~/.kube/config
然后我跑了
kubectl run nginx-image --kubeconfig ~/.kube/config --image nginx
再次抛出:
error: Missing or incomplete configuration info. Please point to an existing, complete config file:
1. Via the command-line flag --kubeconfig
2. Via the KUBECONFIG environment variable
3. In your home directory as ~/.kube/config
minikube start 解决了这个问题,但它正在占用资源......
我只想问如何在不启动 minikube(或其他此类解决方案)的情况下运行 kubectl?请告诉我是否不可能
当我跑步时kubectl get pods
,我得到了两个豆荚,而我只想要一个,我知道这是可能的,因为我在一些视频教程中看到过。
请帮忙...
解决方案
Kubectl 是一个命令行工具,它负责与 Minikube 通信。Kubectl 允许您对 Minikube 运行命令。您可以使用 Kubectl 部署应用程序、检查和管理资源以及查看日志。当你执行这个命令
kubectl run nginx-image --image nginx
kubectl 尝试连接到 minikube 并将您的请求(运行 Nginx)发送给它。所以如果你停止 minikube,kubectl 就无法通信。所以 minikube 负责运行 Nginx 而 kubectl 只负责告诉 Minikube 运行 Nginx
推荐阅读
- scala - 如何从 Source 或 Flow 中的元素生成物化值?
- java - 在Java中存储货币双倍(浮点),没有任何数学,总是准确的吗?
- php - 如何从 htaccess 的重写条件中排除子文件夹规则
- typescript - 打字稿:动态检查第二个参数键在第一个参数上不存在
- npm - Netlify 上的私有 github npm 存储库
- java - 用于 C# .Net 框架的 AndroidJavaClass 和 AndroidJavaObject
- javascript - 强制 Algolia 对相交过滤器数量的重视程度高于其分数
- c# - 这会创建多个线程吗?
- vue.js - 使用 Dropzone 将图像转换为 base64
- r - R:pivot_wider 问题:“值不是唯一标识的”