简介:
搭建过k8s童鞋应该都懂搭建的痛苦,现分享k8s三主两从高可用架构虚拟机镜像,下载后直接导入vmware虚拟机即可,省去搭建烦恼,直接开始k8s学习之旅。
环境
系统:CentOS 7.9内核版本:6.4
Kubernetes :v1.28.0
etcd : 3.5.9
helm:3.12.3
节点分布
192.168.1.51- 192.168.1.53 为master节点,用nginx做高可用,etcd做共享存储
192.168.1.54- 192.168.1.55 为node节点
查看po状态
[root@k8s-master01 ~]# kubectl get po -A
NAMESPACE NAME READY STATUS RESTARTS AGE
default tomcat6-64cdbd884f-shnnk 1/1 Running 0 175m
kube-system calico-kube-controllers-5bf57cc9c8-4mp4h 1/1 Running 6 (42m ago) 3h23m
kube-system calico-node-4bvmp 1/1 Running 0 3h23m
kube-system calico-node-c55hh 1/1 Running 0 3h23m
kube-system calico-node-jqnvf 1/1 Running 0 3h23m
kube-system calico-node-sz6jb 1/1 Running 0 3h23m
kube-system calico-node-zx7gp 1/1 Running 0 3h23m
kube-system calico-typha-c6589cbc7-x2szw 1/1 Running 0 3h23m
kube-system coredns-coredns-5959ff9594-kk4q8 1/1 Running 0 3h15m
kube-system kubernetes-dashboard-65cd84fc57-wjh8l 1/1 Running 0 3h6m
kube-system metrics-server-5fcd46896-wjbq2 1/1 Running 0 3h12m
查看k8s资源状态
[root@k8s-master01 ~]# kubectl top node
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
k8s-master01 97m 4% 1075Mi 58%
k8s-master02 80m 4% 922Mi 50%
k8s-master03 72m 3% 818Mi 44%
k8s-node01 38m 1% 447Mi 24%
k8s-node02 51m 2% 582Mi 31%
测试ingress
[root@k8s-master01 ~]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 3h34m
tomcat6 NodePort 10.109.93.51 <none> 8080:32371/TCP 176m
[root@k8s-master01 ~]# curl -I 192.168.1.51:32371
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
ETag: W/"7454-1491118183000"
Last-Modified: Sun, 02 Apr 2017 07:29:43 GMT
Content-Type: text/html
Content-Length: 7454
Date: Mon, 28 Aug 2023 06:53:19 GMT
加本地hosts测试 192.168.1.9www.aaa.com
访问dashboard
地址:https://192.168.1.51:31518/
获取登录token:
[root@k8s-master01 ~]# kubectl -n kube-system create token admin-user
eyJhbGciOiJSUzI1NiIsImtpZCI6IlhMbXJKcXlsYW05cVNONmZ6R08zY3djMlBGMmZzS3pSZ2hBOVo2TldPVUUifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNjkzMjA5NDcxLCJpYXQiOjE2OTMyMDU4NzEsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJhZG1pbi11c2VyIiwidWlkIjoiZDljNzk0MGMtZTUwZi00ODY1LTg0YmYtZmMwOTgwZWU5NmRhIn19LCJuYmYiOjE2OTMyMDU4NzEsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTphZG1pbi11c2VyIn0.LdFqlu0e18rPG_TgAq535us7fGNOOtu3luFapxaFWe8NwUMmZ1QeTCcaeRhhNPlhTvwwroVksA-jcI2zVkCUWnZUNuCnmf9Ro7N-VlryXNNBb98SGojlgDLdJQRmMoW-A-RNH5NUfwenDuuL3WGs1q8FjCSNil3ok3X3yQSX7M0WA-9zCGJSJBDFxWqfB5rMfsbuQo3nPKbWECXL-wAgAhgPXOIxQgrCfTtNkMJBAH0pmxVon6yv3QKpFYYvLIDyelxJ-F_zZ53k0-wwAiQ-uDZx243LPVPetrJjNM6AfVYFaeNWv-IaRw3S3F4T-B7R2o7sA1Agq6STq6T4KJQLEg
k8s虚拟机下载:https://www.aliyundrive.com/s/G27E2ZNYYwd
文件里面有.mp4后缀的删除.mp4即可,阿里云盘对文件的限制