Microk8s安装在默认端口16443上。我想把它换成6443。我正在使用Ubuntu 16.04。我已经安装了microk8s,使用的是管理单元和调用程序。
我尝试过的下列选项都没有奏效。
/snap/microk8s/current/kubeproxy.config中的端口。由于卷是只读的,所以我无法编辑它./home/user_name/.kube/config并重新启动集群。sudo kubectl config set clusters.microk8s-cluster.server https://my_ip_address:6443。kubectl proxy --port=6443 --address=0.0.0.0 --accept-hosts=my_ip_address &。它监听6443,但只监听HTTP,而不是HTTPS流量。发布于 2019-04-18 05:00:29
这一问题最初在microk8s第43期中解决,但在microk8s第300期中详细说明。
这是用于最新microk8s的正确方法:
#!/bin/bash
# define our new port number
API_PORT=8888
# update kube-apiserver args with the new port
# tell other services about the new port
sudo find /var/snap/microk8s/current/args -type f -exec sed -i "s/8080/$API_PORT/g" {} ';'
# create new, updated copies of our kubeconfig for kubelet and kubectl to use
mkdir -p ~/.kube && microk8s.config -l | sed "s/:8080/:$API_PORT/" | sudo tee /var/snap/microk8s/current/kubelet.config > ~/.kube/microk8s.config
# tell kubelet about the new kubeconfig
sudo sed -i 's#${SNAP}/configs/kubelet.config#${SNAP_DATA}/kubelet.config#' /var/snap/microk8s/current/args/kubelet
# disable and enable the microk8s snap to restart all services
sudo snap disable microk8s && sudo snap enable microk8shttps://stackoverflow.com/questions/55736881
复制相似问题