请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

api server对外暴露8080报错

修改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
#   }

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

正在回答 回答被采纳积分+3

1回答

刘果国 2022-09-22 09:45:09

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

                                                                               
translator
                               
                                                       Double-click                                                    
                               
                                                       Select to translate                                                    
           
0 回复 有任何疑惑可以回复我~
  • 提问者 会飞的小白菜 #1
    报的错误是一样的,老师你看一下,我发在新提问上了
    回复 有任何疑惑可以回复我~ 2022-09-22 11:16:19
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信