api server对外暴露8080报错

来源:11-7 KubernetesAPI ---如何开发一个基于kubernetes的容器管理平台

会飞的小白菜

2022-09-21

修改pod配置文件

[root@node-1-bak 10-statefulset]# kubectl edit  pod/kube-apiserver-node-1-bak -n kube-system
 - --insecure-port=8080

保存后报错:

# pods "kube-apiserver-node-1-bak" was not valid:
# * 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)
#   core.PodSpec{
#       Volumes:        []core.Volume{{Name: "ca-certs", VolumeSource: core.VolumeSource{HostPath: &core.HostPathVolumeSource{Path: "/etc/ssl/certs", Type: &"DirectoryOrCreate"}}}, {Name: "etc-pki", VolumeSource: core.VolumeSource{HostPath: &core.HostPathVolumeSource{Path: "/etc/pki", Type: &"DirectoryOrCreate"}}}, {Name: "etc-pki-ca-trust", VolumeSource: core.VolumeSource{HostPath: &core.HostPathVolumeSource{Path: "/etc/pki/ca-trust", Type: &""}}}, {Name: "etc-pki-tls", VolumeSource: core.VolumeSource{HostPath: &core.HostPathVolumeSource{Path: "/etc/pki/tls", Type: &""}}}, {Name: "etcd-certs-0", VolumeSource: core.VolumeSource{HostPath: &core.HostPathVolumeSource{Path: "/etc/ssl/etcd/ssl", Type: &"DirectoryOrCreate"}}}, {Name: "k8s-certs", VolumeSource: core.VolumeSource{HostPath: &core.HostPathVolumeSource{Path: "/etc/kubernetes/ssl", Type: &"DirectoryOrCreate"}}}},
#       InitContainers: nil,
#       Containers: []core.Container{
#               {
#                       Name:  "kube-apiserver",
#                       Image: "k8s.gcr.io/kube-apiserver:v1.19.7",
#                       Command: []string{
#                               ... // 17 identical elements
#                               "--event-ttl=1h0m0s",
# -                             "--insecure-port=8080",
# +                             "--insecure-port=0",
#                               "--kubelet-client-certificate=/etc/kubernetes/ssl/apiserver-kubelet-client.crt",
#                               "--kubelet-client-key=/etc/kubernetes/ssl/apiserver-kubelet-client.key",
#                               ... // 17 identical elements
#                       },
#                       Args:       nil,
#                       WorkingDir: "",
#                       ... // 17 identical fields
#               },
#       },
#       EphemeralContainers: nil,
#       RestartPolicy:       "Always",
#       ... // 25 identical fields
#   }

这个要怎么办呢?先停掉在重新创建么?

写回答

1回答

刘果国

2022-09-22

建议修改走yaml,直接apply即可

                                                                               
translator
                               
                                                       Double-click                                                    
                               
                                                       Select to translate                                                    
           
0
1
会飞的小白菜
报的错误是一样的,老师你看一下,我发在新提问上了
2022-09-22
共1条回复

Kubernetes生产落地全程实践

一个互联网公司落地Kubernetes全过程点点滴滴

2293 学习 · 2217 问题

查看课程