kubernetes入门(10)kubernetes单机安装后 - helloworld

时间:2023-03-09 00:27:33
kubernetes入门(10)kubernetes单机安装后 - helloworld

前言

查看端口是否被监听了 ::netstat -tlp |grep 31002

我是用的yum install etcd kubernetes docker vim, 这样装的是1.5.2,不是最新版本的kubernetes

据说可以下载*Admin安装kubernetes,装的比较新,1.7以上才支持istio的!

一、安装业务应用

1、安装

kubectl create -f mysql-rc.xml

kubectl create -f mysql-svc.xml

kubectl create -f myweb-rc.xml

kubectl create -f myweb-svc.xml

2、检查

kubectl get rc

kubectl get pods

kubectl get services

3、问题1:发现pod都在containercreating状态,不是running

运行 kubectl get pods 发现一直在containercreating状态,执行 kubectl describe pod xxxx,发现基础镜像找不到

Error syncing pod, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"registry.access.redhat.com/rhel7/pod-infrastructure:latest\""
百度到的解决办法有:
1\FQ
2\修改hosts文件(这里我用的是“61.91.161.217 gcr.io”,但是可能会失效)
3\从其他源下载容器pod-infrastructure:latest”,然后打tag为“registry.access.redhat.com/rhel7/pod-infrastructure:latest”

我的具体做法:

修改docker配置 vi /etc/sysconfig/docker 增加  --insecure-registry gcr.io  --registry-mirror=https://olzwzeg2.mirror.aliyuncs.com , systemctl restart docker

从hub.com 搜索下载镜像 pod-infrastructure:latest,修改tag:docker tag xxx

kubernetes入门(10)kubernetes单机安装后 - helloworld

2.2、192.168.136.103:30001

kubectl get service

kubernetes入门(10)kubernetes单机安装后 - helloworld

使用当前node的ip+30001构造测试地址::http://192.168.136.103:30001/demo

报错如下:Error:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

解决办法: