我是靠谱客的博主 懦弱哈密瓜,这篇文章主要介绍k8s坑The connection to the server localhost:8080 was refused - did you specify the right host or port,现在分享给大家,希望可以做个参考。
定义一个mysql的RC文件:mysql-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: mysql
spec:
replicas: 1
selector:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql
ports:
- containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
value: "123456"
发布到k8s集群中
# kubectl create -f mysql-rc.yaml
报错:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
没有启动k8s集群或启动顺序不对,重新按一下顺序启动所有服务:
# systemctl start etcd
# systemctl start docker
# systemctl start kube-apiserver
# systemctl start kube-controller-manager
# systemctl start kube-scheduler
# systemctl start kubelet
# systemctl start kube-proxy
然后再发布mysql-rc.yaml就不报错了
最后
以上就是懦弱哈密瓜最近收集整理的关于k8s坑The connection to the server localhost:8080 was refused - did you specify the right host or port的全部内容,更多相关k8s坑The内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复