Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

部分 XI. Kubernetes

目录

107. Minikube
107.1. CentOS 8 安装 minikube
107.1.1. CentOS
107.1.2. Mac OS
107.2. Quickstart
107.3. minikube 命令
107.3.1. minikube ip 地址
107.3.2. 启动 minikube
107.3.3. 停止 minikube
107.3.4. Docker 环境变量
107.3.5. SSH
107.3.6. 缓存镜像
107.3.7. 清理 minikube
107.3.8. Kubernetes 控制面板
107.3.9. service
107.3.10. 查看日志
107.3.11. 查看 Docker 环境变量
107.3.12. profile
107.3.13. addons
107.3.14. SSH
107.3.15. 查看IP地址
107.3.16. 镜像管理
107.3.17. kubectl
107.4. Minikube 案例演示
107.5. FAQ
107.5.1. This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory
107.5.2. ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables
107.5.3. ERROR ImagePull
107.5.4. 证书已存在错误
107.5.5. http: server gave HTTP response to HTTPS client
107.5.6. provided port is not in the valid range. The range of valid ports is 30000-32767
107.5.7. Exiting due to MK_ENABLE: run callbacks: running callbacks: [verifying registry addon pods : timed out waiting for the condition: timed out waiting for the condition]
107.5.8. Exiting due to SVC_URL_TIMEOUT: http://127.0.0.1:11068/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ is not accessible: Temporary Error: unexpected response code: 503
107.5.9. Mac minikube ip 不通,ingress 不工作
108. microk8s
108.1. 安装 microk8s
108.1.1. 安装指定版本
108.2. 组件管理
108.2.1. dns
108.2.2. dashboard
108.3. kubectl
108.4. Kubernetes Addons
108.4.1.
109. Kubernetes 集群管理
109.1. 配置
109.1.1. KUBECONFIG
109.1.2. use-context
109.2. 如何从 docker 过渡到 kubectl 命令
109.2.1. 执行 Shell
109.2.2. 查看信息
109.2.3. 查看 pod 日志
109.2.4. 复制文件
109.2.5. edit
109.2.6. 端口转发
109.2.7. 操作系统资源配置
109.2.8. endpoints
109.2.9. explain
109.2.10. describe
109.3. namespace 命名空间
109.3.1. 查看命名空间
109.3.2. 创建命名空间
109.3.3. 使用 yaml 创建命名空间
109.3.4. 删除命名空间
109.4. label 标签
109.5. 服务管理
109.5.1. 列出服务
109.5.2. 创建服务
109.5.3. 查看服务详细信息
109.5.4. 更新服务
109.5.5. 删除服务
109.5.6. clusterip
109.5.7. 设置外部IP
109.5.8. externalname
109.5.9. 负载均衡
109.5.10. nodeport
109.5.11. Example
109.6. serviceaccount
109.7. Pod 管理
109.7.1. 查看 POD 状态
109.7.2. 运行 POD
109.7.3. 删除 pod
109.7.4. 查看 Pod 的事件
109.7.5. Taint(污点)和 Toleration(容忍)
109.7.6. 镜像拉取策略
109.7.7. 指定主机名
109.7.8. 环境变量
109.7.9. 健康状态检查
109.7.10. securityContext
109.7.11. nodeName 选择节点
109.7.12. nodeSelector 选择节点
109.7.13. nodeAffinity 选择节点
109.7.14. Taint(污点)和 Toleration(容忍)
109.7.15. strategy
109.8. 部署管理
109.8.1. expose
109.8.2. 部署容器
109.8.3. 删除 deployment
109.8.4. 扩容管理
109.8.5. rollout
109.8.6. 重启容器
109.8.7. 更新镜像
109.9. secret 密钥管理
109.9.1. 获取 Token
109.9.2. 创建 Secret
109.9.3. Private Registry 用户认证
109.9.4. 配置TLS SSL
109.10. ConfigMap
109.10.1. 创建 Key-Value 配置项
109.10.2. 从文件创建 ConfigMap
109.10.3. 从环境变量文件创建 ConfigMap
109.10.4. 查看 ConfigMap
109.10.5. 删除 ConfigMap
109.10.6. ConfigMap
109.11. Job/CronJob
109.11.1. CronJob
109.11.2. Job
109.12. clusterrolebinding
109.13. Volume
109.13.1. local
109.14. Ingress
109.14.1. 管理 Ingress
109.14.2. 挂载 SSL 证书上
109.14.3. 端口
109.14.4. URI 规则
109.14.5. vhost 虚拟主机
109.14.6. rewrite
109.14.7. annotations 配置
109.14.8. 金丝雀发布(灰度发布)
109.14.9. 解决 504 网关超时
110. kubectl example
110.1. 私有 registry
110.2. mongodb
110.3. tomcat
111. istio
111.1. 启动 istio
111.2. 禁用 istio
112. Kubeapps
113. Helm - The package manager for Kubernetes
113.1. 安装 Helm
113.1.1. AlmaLinux
113.1.2. Rocky Linux
113.1.3. Ubuntu
113.1.4. Mac
113.2. 快速开始
113.3. Helm 命令
113.3.1. 初始化 Helm
113.3.2. 查看仓库列表
113.3.3. 搜索
113.3.4. 查看包信息
113.3.5. 安装
113.3.6. 列表
113.3.7. 删除
113.3.8. 升级
113.3.9. 回滚
113.3.10. 查看状态
113.4. ingress-nginx
113.5. elastic
113.6. Helm The package manager for Kubernetes
113.7. Helm Faq
114. Rancher - Multi-Cluster Kubernetes Management
114.1. 安装 Rancher
114.1.1. Rancher Server
114.1.2. Rancher Kubernetes Engine (RKE) 2
114.1.3. Rancher Kubernetes Engine (RKE) 1
114.1.4. Rancher CLI
114.1.5. rancher-compose
114.2. 快速入门
114.2.1. API
114.3. Rancher Compose
114.3.1. Rancher Compose 命令
114.3.2. 操作演示
114.4. Rancher CLI
114.4.1. 登陆 Rancher
114.4.2. 查看集群
114.4.3. 查看节点
114.4.4. catalog
114.4.5. 查看设置
114.4.6. rancher kubectl
114.5. K3s
114.5.1. AutoK3s
114.5.2. 安装 K3s(Docker 模式)
114.5.3. 安装 K3s(VM 模式)
114.5.4. k3d
114.5.5. TLS 证书
114.5.6. 创建 Token
114.5.7. FAQ
114.6. Rancher Demo
114.6.1. Rancher 部署 Nginx
114.6.2. local-path-provisioner
114.7. Longhorn
114.7.1. 安装 Longhorn
114.7.2. 选择磁盘类型
114.7.3. 节点选择
114.7.4. FAQ
114.8. FAQ
114.8.1. 调试 Rancher 查看日志
114.8.2. [network] Host [rancher.netkiller.cn] is not able to connect to the following ports: [rancher.netkiller.cn:2379]. Please check network policies and firewall rules
114.8.3. cgroups v2

1. 常见问题

1.1. 从局域网访问POD

		
宿主主机:172.18.200.5
POD网络:

[root@agent-5 ~]# kubectl -n project get pods -o wide
NAME                                         READY   STATUS             RESTARTS         AGE     IP            NODE      NOMINATED NODE   READINESS GATES
neo-sms-cb888b96b-khhjb                 	 1/1     Running            0                9d      10.42.0.101   master    <none>           <none>
neo-xxl-job-admin-6868fc69b6-rdjkx     	 	 1/1     Running            0                9d      10.42.6.165   agent-5   <none>           <none>
neo-job-executor-5ddd9c8f56-6pbzr       	 1/1     Running            0                9d      10.42.6.164   agent-5   <none>           <none>
netkiller-gateway-575cc78dd8-pg8w7           1/1     Running            0                9d      10.42.1.182   agent-1   <none>           <none>
netkiller-aaa-portal-f49849579-l4gp5         1/1     Running            0                9d      10.42.0.102   master    <none>           <none>
netkiller-pay-5d4bbcd695-47v7w               1/1     Running            0                9d      10.42.0.112   master    <none>           <none>
netkiller-pay-5565c6ffc-x4gl2                1/1     Running            0                9d      10.42.0.116   master    <none>           <none>
neo-finance-admin-696f55f858-ffgbt           1/1     Running            0                8d      10.42.1.232   agent-1   <none>           <none>
neo-finance-7676dcbf8-q2sxq                  1/1     Running            0                5d18h   10.42.1.23    agent-1   <none>           <none>
		
		

我们只需要在访问 POD 的机器上配置路由即可

		
root@netkiller ~# ip route add 10.42.0.0/16 via 172.18.200.5		
		
		

ping 测试

		
root@netkiller ~# ping 10.42.1.101 -c 1
PING 10.42.1.101 (10.42.1.101) 56(84) bytes of data.
64 bytes from 10.42.1.101: icmp_seq=1 ttl=62 time=0.530 ms

--- 10.42.1.101 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.530/0.530/0.530/0.000 ms		
		
		

MacOS

		
sudo route -n add -net 192.168.0.0 -netmask 255.255.255.0 192.168.5.254 
sudo route -n add -net 10.42.0.0 -netmask 255.255.0.0 172.18.200.5 		


Last login: Wed Apr 19 16:43:30 on ttys007
neo@MacBook-Pro-M2 ~ % sudo route -n add -net 10.42.0.0 -netmask 255.255.0.0 172.18.200.5
Password:
add net 10.42.0.0: gateway 172.18.200.5