如何将minikube启动参数设置apiserver从8443修改为6443

How to modify the minikube start parameter setting apiserver from 8443 to 6443

我正在使用 minikube 来测试 kompose。 我使用以下 minikube 命令安装了 k8s

# minikube start --driver=none --kubernetes-version v1.16.0
minikube v1.9.2 on Ubuntu 18.04
✨  Using the none driver based on user configuration
  Starting control plane node  in cluster minikube
  Running on localhost (CPUs=XX, Memory=XXXXXMB, Disk=XXXXXMB) ...
ℹ️  OS release is Ubuntu 18.04.3 LTS
  Preparing Kubernetes v1.16.0 on Docker 18.09.7 ...
    ▪ kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
❗  This bare metal machine is having trouble accessing https://k8s.gcr.io
  To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
  Enabling addons: default-storageclass, storage-provisioner
  Configuring local host environment ...

❗  The 'none' driver is designed for experts who need to integrate with an existing VM
  Most users should use the newer 'docker' driver instead, which does not require root!
  For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/none/

❗  kubectl and minikube configuration will be stored in /root
❗  To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:

    ▪ sudo mv /root/.kube /root/.minikube $HOME
    ▪ sudo chown -R $USER $HOME/.kube $HOME/.minikube

  This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
  Done! kubectl is now configured to use "minikube"
  For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/

curl, chmod, mv安装kubectl

# kubectl versionClient Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}

但是当我使用kompose up命令时,它显示connection rejection

kompose -f docker-compose.yaml up
INFO We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application. If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead. 

FATA Error while deploying application: Get https://127.0.0.1:6443/api: dial tcp 127.0.0.1:6443: connect: connection refused

查询kubectl配置发现其端口为8443,与kompose up[=34连接的6443不同=]

# kubectl cluster-info
Kubernetes master is running at https://172.26.90.122:8443
KubeDNS is running at https://172.26.90.122:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

我认为这是问题所在,但我不知道如何fix it to make the ports match,对吧。

如果你能告诉我如何解决,我将不胜感激?

你在启动命令中添加这个标志

--apiserver-port=6443