运行 Windows Docker Kubernetes 集群上的映像,安装在 Windows 10
Running Windows Docker Images on Kubernetes Cluster, installed on Windows 10
我已经在我的 Windows 10 机器上安装了 Kubernetes Cluster (minikube),似乎 运行ning(即:我可以浏览 minikube 仪表板等)。
我在 Azure 容器注册表上也有一个 Windows 图像(其中有一个 Asp.Net Web API .Net framework 4.6 应用程序),我想将其拉取并部署到我本地的 Kubernetes 集群。
我构建了以下 yaml 文件来创建 Kubernetes 部署:
apiVersion: v1
kind: Pod
metadata:
name: hubapi
spec:
containers:
- name: hubapi
image: lgmimages.azurecr.io/hubapi/hubapi
imagePullSecrets:
- name: azurepasswordsecret
当我运行这个命令时:
kubectl create -f hubapi.yaml
我看到了:
pod "hubapi" created
然后当我转到仪表板或获取 Pod 描述时,我看到以下错误:
kubelet, minikube Failed to pull image "lgmimages.azurecr.io/hubapi/hubapi": rpc error: code = Unknown desc = image operating system "windows" cannot be used on this platform
我想知道我在这里遗漏了什么,我正在尝试做的事情是否可行?
注意: 当我使用这个命令并从 dockerhub 中拉取 nginx 镜像时它起作用了:
kubectl run kubernetes-nginx --image=nginx:latest --port=80
然后我把这个服务暴露出来,就可以在我本地的Cluster上浏览nginx的网页了
rpc error: code = Unknown desc = image operating system "windows"
cannot be used on this platform
其实我们在windows10bash上Ubuntu安装kubernetes,这样,bash上ubuntu作为大师,基于Linux,我们不能运行 windows docker 图像
我们知道,kubernetes master应该是一个Linux,你没有其他节点,所以我们不能在上面运行 windows
docker镜像。
为了测试,您可以使用Azure container service
并部署kubernetes
和windows个节点,这样,我们可以运行 Windows docker k8s windows 节点上的图像。
希望这对您有所帮助:)
如果你想设置一个 Kubernetes 集群,节点 运行 同时包含 Windows 和 Linux,你可以给 (kubernetes-windows-vagrant)[https://github.com/rjmorse/kubernetes-windows-vagrant]一试。它使用 Vagrant 提供环境。
您可以使用 Docker for Windows 而不是 minikube,并启用 Windows 容器模式(切换到 Windows 容器...系统托盘中的上下文菜单选项) .
我已经在我的 Windows 10 机器上安装了 Kubernetes Cluster (minikube),似乎 运行ning(即:我可以浏览 minikube 仪表板等)。
我在 Azure 容器注册表上也有一个 Windows 图像(其中有一个 Asp.Net Web API .Net framework 4.6 应用程序),我想将其拉取并部署到我本地的 Kubernetes 集群。
我构建了以下 yaml 文件来创建 Kubernetes 部署:
apiVersion: v1
kind: Pod
metadata:
name: hubapi
spec:
containers:
- name: hubapi
image: lgmimages.azurecr.io/hubapi/hubapi
imagePullSecrets:
- name: azurepasswordsecret
当我运行这个命令时:
kubectl create -f hubapi.yaml
我看到了:
pod "hubapi" created
然后当我转到仪表板或获取 Pod 描述时,我看到以下错误:
kubelet, minikube Failed to pull image "lgmimages.azurecr.io/hubapi/hubapi": rpc error: code = Unknown desc = image operating system "windows" cannot be used on this platform
我想知道我在这里遗漏了什么,我正在尝试做的事情是否可行?
注意: 当我使用这个命令并从 dockerhub 中拉取 nginx 镜像时它起作用了:
kubectl run kubernetes-nginx --image=nginx:latest --port=80
然后我把这个服务暴露出来,就可以在我本地的Cluster上浏览nginx的网页了
rpc error: code = Unknown desc = image operating system "windows" cannot be used on this platform
其实我们在windows10bash上Ubuntu安装kubernetes,这样,bash上ubuntu作为大师,基于Linux,我们不能运行 windows docker 图像
我们知道,kubernetes master应该是一个Linux,你没有其他节点,所以我们不能在上面运行 windows
docker镜像。
为了测试,您可以使用Azure container service
并部署kubernetes
和windows个节点,这样,我们可以运行 Windows docker k8s windows 节点上的图像。
希望这对您有所帮助:)
如果你想设置一个 Kubernetes 集群,节点 运行 同时包含 Windows 和 Linux,你可以给 (kubernetes-windows-vagrant)[https://github.com/rjmorse/kubernetes-windows-vagrant]一试。它使用 Vagrant 提供环境。
您可以使用 Docker for Windows 而不是 minikube,并启用 Windows 容器模式(切换到 Windows 容器...系统托盘中的上下文菜单选项) .