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

部分 I. Kubernetes

目录

4. Minikube
4.1. CentOS 8 安装 minikube
4.1.1. CentOS
4.1.2. Mac OS
4.2. Quickstart
4.3. minikube 命令
4.3.1. minikube ip 地址
4.3.2. 启动 minikube
4.3.3. 停止 minikube
4.3.4. Docker 环境变量
4.3.5. SSH
4.3.6. 缓存镜像
4.3.7. 清理 minikube
4.3.8. Kubernetes 控制面板
4.3.9. service
4.3.10. 查看日志
4.3.11. 查看 Docker 环境变量
4.3.12. profile
4.3.13. addons
4.3.14. SSH
4.3.15. 查看IP地址
4.3.16. 镜像管理
4.3.17. kubectl
4.4. Minikube 案例演示
4.5. FAQ
4.5.1. This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory
4.5.2. ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables
4.5.3. ERROR ImagePull
4.5.4. 证书已存在错误
4.5.5. http: server gave HTTP response to HTTPS client
4.5.6. provided port is not in the valid range. The range of valid ports is 30000-32767
4.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]
4.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
4.5.9. Mac minikube ip 不通,ingress 不工作
5. microk8s
5.1. 安装 microk8s
5.1.1. 安装指定版本
5.2. 组件管理
5.2.1. dns
5.2.2. dashboard
5.3. kubectl
5.4. Kubernetes Addons
5.4.1.
6. Kubernetes 集群管理
6.1. 配置
6.1.1. KUBECONFIG
6.1.2. use-context
6.2. 如何从 docker 过渡到 kubectl 命令
6.2.1. 执行 Shell
6.2.2. 查看信息
6.2.3. 查看 pod 日志
6.2.4. 复制文件
6.2.5. edit
6.2.6. 端口转发
6.2.7. 操作系统资源配置
6.2.8. endpoints
6.2.9. explain
6.2.10. describe
6.3. namespace 命名空间
6.3.1. 查看命名空间
6.3.2. 创建命名空间
6.3.3. 使用 yaml 创建命名空间
6.3.4. 删除命名空间
6.4. label 标签
6.5. 服务管理
6.5.1. 列出服务
6.5.2. 创建服务
6.5.3. 查看服务详细信息
6.5.4. 更新服务
6.5.5. 删除服务
6.5.6. clusterip
6.5.7. 设置外部IP
6.5.8. externalname
6.5.9. 负载均衡
6.5.10. nodeport
6.5.11. Example
6.6. serviceaccount
6.7. Pod 管理
6.7.1. 查看 POD 状态
6.7.2. 运行 POD
6.7.3. 删除 pod
6.7.4. 查看 Pod 的事件
6.7.5. Taint(污点)和 Toleration(容忍)
6.7.6. 镜像拉取策略
6.7.7. 指定主机名
6.7.8. 环境变量
6.7.9. 健康状态检查
6.7.10. securityContext
6.7.11. nodeName 选择节点
6.7.12. nodeSelector 选择节点
6.7.13. nodeAffinity 选择节点
6.7.14. Taint(污点)和 Toleration(容忍)
6.7.15. strategy
6.8. 部署管理
6.8.1. expose
6.8.2. 部署容器
6.8.3. 删除 deployment
6.8.4. 扩容管理
6.8.5. rollout
6.8.6. 重启容器
6.8.7. 更新镜像
6.9. secret 密钥管理
6.9.1. 获取 Token
6.9.2. 创建 Secret
6.9.3. Private Registry 用户认证
6.9.4. 配置TLS SSL
6.10. ConfigMap
6.10.1. 创建 Key-Value 配置项
6.10.2. 从文件创建 ConfigMap
6.10.3. 从环境变量文件创建 ConfigMap
6.10.4. 查看 ConfigMap
6.10.5. 删除 ConfigMap
6.10.6. ConfigMap
6.11. Job/CronJob
6.11.1. CronJob
6.11.2. Job
6.12. clusterrolebinding
6.13. Volume
6.13.1. local
6.14. Ingress
6.14.1. 管理 Ingress
6.14.2. 挂载 SSL 证书上
6.14.3. 端口
6.14.4. URI 规则
6.14.5. vhost 虚拟主机
6.14.6. rewrite
6.14.7. annotations 配置
6.14.8. 金丝雀发布(灰度发布)
6.14.9. 解决 504 网关超时
7. kubectl example
7.1. 私有 registry
7.2. mongodb
7.3. tomcat
8. istio
8.1. 启动 istio
8.2. 禁用 istio
9. Kubeapps
10. Helm - The package manager for Kubernetes
10.1. 安装 Helm
10.1.1. AlmaLinux
10.1.2. Rocky Linux
10.1.3. Ubuntu
10.1.4. Mac
10.2. 快速开始
10.3. Helm 命令
10.3.1. 初始化 Helm
10.3.2. 查看仓库列表
10.3.3. 搜索
10.3.4. 查看包信息
10.3.5. 安装
10.3.6. 列表
10.3.7. 删除
10.3.8. 升级
10.3.9. 回滚
10.3.10. 查看状态
10.4. ingress-nginx
10.5. elastic
10.6. Helm The package manager for Kubernetes
10.7. Helm Faq
11. Rancher - Multi-Cluster Kubernetes Management
11.1. 安装 Rancher
11.1.1. Rancher Server
11.1.2. Rancher Kubernetes Engine (RKE) 2
11.1.3. Rancher Kubernetes Engine (RKE) 1
11.1.4. Rancher CLI
11.1.5. rancher-compose
11.2. 快速入门
11.2.1. API
11.3. Rancher Compose
11.3.1. Rancher Compose 命令
11.3.2. 操作演示
11.4. Rancher CLI
11.4.1. 登陆 Rancher
11.4.2. 查看集群
11.4.3. 查看节点
11.4.4. catalog
11.4.5. 查看设置
11.4.6. rancher kubectl
11.5. K3s
11.5.1. AutoK3s
11.5.2. 安装 K3s(Docker 模式)
11.5.3. 安装 K3s(VM 模式)
11.5.4. k3d
11.5.5. TLS 证书
11.5.6. 创建 Token
11.5.7. FAQ
11.6. Rancher Demo
11.6.1. Rancher 部署 Nginx
11.6.2. local-path-provisioner
11.7. Longhorn
11.7.1. 安装 Longhorn
11.7.2. 选择磁盘类型
11.7.3. 节点选择
11.7.4. FAQ
11.8. FAQ
11.8.1. 调试 Rancher 查看日志
11.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
11.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