K8s1.18.0 安装配置 Kuboard v2
官方文档: https://kuboard.cn/learning/k8s-intermediate/service/network.html#%E6%95%B0%E6%8D%AE%E5%8C%85%E7%9A%84%E4%BC%A0%E9%80%92-pod-to-pod-%E8%B7%A8%E8%8A%82%E7%82%B9
获取yaml文件
kubectl apply -f https://kuboard.cn/install-script/kuboard.yaml
kubectl apply -f https://addons.kuboard.cn/metrics-server/0.3.7/metrics-server.yaml
获取Token
echo $(kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep kuboard-user | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)
查看 Kuboard 运行状态
kubectl get pods -l k8s.kuboard.cn/name=kuboard -n kube-system -o wide
[root@test3 data]# kubectl get pods -l k8s.kuboard.cn/name=kuboard -n kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kuboard-5967d77d89-g864c 0/1 ContainerCreating 0 3m41s <none> test1 <none> <none>
kuboard-7986796cf8-fhs4m 1/1 Running 0 13m 10.122.32.148 k8s-master01 <none> <none>
访问登录
https://192.168.31.10:32567
搭建部署一个nginx服务
点击保存 创建nginx的Deployments
NFS部署搭建
[root@k8s-master01 ~]# yum install -y nfs-utils
[root@k8s-master01 ~]# vim /etc/exports
/data/k8snfs 192.168.31.10(rw,sync,no_root_squash)
/data/k8snfs 192.168.31.243(rw,sync,no_root_squash)
/data/k8snfs 192.168.31.5(rw,sync,no_root_squash)
[root@k8s-master01 ~]# systemctl start nfs
[root@k8s-master01 ~]# showmount -e 192.168.31.10
Export list for 192.168.31.10:
/data/k8snfs 192.168.31.5,192.168.31.243,192.168.31.10
部署的nginx服务 会自动生成一个NFS的pod
进入NFS查看目录生成
访问nginx服务
[root@k8s-master01 nginx]# kubectl get pod -n default -o wide #查看pod所在node和非配的Ip地址
[root@k8s-master01 nginx]# kubectl get service -n default -o wide #查看pod对应service的Ip地址和对应宿主机的端口
查看各个pod节点和service节点互通情况(calico)
[root@test3 ~]# kubectl run curl --image=radial/busyboxplus:curl -i --tty
[root@test1 ~]# kubectl get service -n default
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.10.0.1 <none> 443/TCP 17d
pod-jenkins NodePort 10.10.210.124 <none> 8080:32277/TCP 10d
redis LoadBalancer 10.10.0.248 <pending> 6379:31170/TCP 13d
web-centos NodePort 10.10.137.89 <none> 5000:30719/TCP 10d
web-nginx NodePort 10.10.94.189 <none> 8090:31569/TCP 7d16h
web-spug NodePort 10.10.52.37 <none> 80:32165/TCP 23h
[root@test1 ~]# kubectl get pod -n default -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
curl 1/1 Running 1 7d16h 10.122.32.172 k8s-master01 <none> <none>
pod-jenkins-78d64f949b-lxfxt 1/1 Running 0 10d 10.122.173.143 test1 <none> <none>
pod-jenkins-78d64f949b-spjx5 1/1 Running 0 10d 10.122.32.169 k8s-master01 <none> <none>
redis-74df6f7f7c-xzh8h 1/1 Running 1 13d 10.122.32.152 k8s-master01 <none> <none>
web-nginx-656b579987-5mwk4 1/1 Running 0 7d16h 10.122.32.174 k8s-master01 <none> <none>
web-nginx-656b579987-qskkm 1/1 Running 0 7d16h 10.122.32.173 k8s-master01 <none> <none>
web-spug-7bcd9ff566-ghkgm 1/1 Running 0 23h 10.122.173.151 test1 <none> <none>
[root@test3 ~]# kubectl exec -it curl /bin/sh