【发布时间】:2017-11-15 18:33:59
【问题描述】:
我有一个 Kubernetes pod,它已经在 Minikube (v0.23.0) 节点上运行。
一些上下文:它是通过启用插件创建的 coredns pod。我正在阅读这篇博文,试图为我的 Kubernetes 集群设置自定义 DNS 条目:https://coredns.io/2017/05/08/custom-dns-entries-for-kubernetes/
我可以毫无问题地替换配置图;我更改了博客文章中的模板规范以满足我的需要并运行:
kubectl create -f configmap.yml -o yaml --dry-run | kubectl replace -f -
这似乎奏效了;我使用 kubectl 检查了 configmap,一切看起来都很好。
但是我不确定如何更新卷。我试着把这样的东西放在一个文件中:
apiVersion: v1
kind: Pod
metadata:
labels:
k8s-app: coredns
namespace: kube-system
spec:
containers:
- name: coredns
volumes:
- configMap:
items:
- key: Corefile
path: Corefile
- key: cluster.db
path: cluster.db
name: coredns
name: config-volume
然后我尝试使用:
kubectl create -f k8s_config/coredns/volumes.yml -o yaml --dry-run | kubectl apply -f -
但这给出了这个错误信息:
error: error when retrieving current configuration of:
&{0xc4218be840 0xc420213500 kube-system STDIN 0xc421a9e5e0 0xc421a9e5e0 false}
from server for: "STDIN": resource name may not be empty
我还尝试将 coredns pod 的内容转储到文件中,相应地更改卷部分,然后替换 pod,但收到以下消息:
The Pod "coredns-6b4fd7784-xhb5s" is invalid: spec: Forbidden: pod updates may not change fields other than `spec.containers[*].image`, `spec.initContainers[*].image`, `spec.activeDeadlineSeconds` or `spec.tolerations` (only additions to existing tolerations)
没有删除 Pod 并将其恢复,我应该如何更新 Pod 中的卷?甚至可能吗?
我想另一个首要问题是:更新/配置coredns pod/plugin 的正确方法是什么?我似乎无法在任何地方找到指南。在博客文章中它说:
要创建新区域,我们需要修改
coredns.yaml我们有 一直用于在 pod 中创建一个附加文件。
但是,这一定是在 Kubernetes 中手动设置 coredns 时出现的,现在它“只是作为一个插件工作”,我不知道如何配置它。
【问题讨论】:
标签: kubernetes minikube coredns