(二十六)、Kuboard 部署网络问题 &k8s 使用本地镜像 & k8s使用 register本地镜像站 综合应用

Kuboard 部署网络问题&k8s 使用本地镜像&k8s使用 register本地镜像站

文章目录

register 如果只是 ip 的话,k8s 中是由于必须使用 https 导致没有办法,因此可以采取先手动把镜像下载到k8s 所在的机器的 docker 本地镜像中,通过 eval $(minikube docker-env) 命令之后,执行

1、k8s 命令

删除 namespace

kubectl delete namespace kuboard

新建 namespace

kubectl create namespace kuboard

2、拉取指定tag:版本镜像

国内

docker pull swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard:v3

VPN不稳定

docker pull kuboard/kuboard:v3

2.1、查看本地镜像

docker images

3、删除本地镜像

docker rmi <镜像ID或镜像名称:标签>

4、本地对镜像进行重命名(docker tag)

docker tag mynginx:latest DiyTag:DiyVersion

5、本地拉取局域网镜像站

192.168.0.116:5001 为局域网镜像站 ip:端口,mynginx:latest 是对应tag 和版本

docker pull 192.168.0.116:5001/mynginx:latest

6、k8s(minikube场景) 直接可以引用本地镜像

从查询顺序来说,k8s 会优先从本地找,下面的命令可以让 minukube 中的 k8s 直接识别docker本地的镜像

eval $(minikube docker-env)

7、执行 kubectl apply -f kuboard-k8s.yaml

此时执行,yaml 就会优先从本地寻找对应 tag和版本的镜像了

注意俩参数
namespace: kuboard
image: eipwork/kuboard:latest

复制代码
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kuboard
  namespace: kuboard
  labels:
    k8s.kuboard.cn/name: kuboard
    k8s.kuboard.cn/layer: monitor
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s.kuboard.cn/name: kuboard
      k8s.kuboard.cn/layer: monitor
  template:
    metadata:
      labels:
        k8s.kuboard.cn/name: kuboard
        k8s.kuboard.cn/layer: monitor
    spec:
      containers:
      - name: kuboard
        image: eipwork/kuboard:latest
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        resources:
          limits:
            cpu: 500m
            memory: 512Mi
          requests:
            cpu: 100m
            memory: 128Mi
      tolerations:
      - key: node-role.kubernetes.io/master
        operator: Exists
        effect: NoSchedule
---
apiVersion: v1
kind: Service
metadata:
  name: kuboard
  namespace: kuboard
spec:
  type: NodePort
  ports:
  - name: http
    port: 80
    targetPort: 80
    #nodePort: 32567
  selector:
    k8s.kuboard.cn/name: kuboard
    k8s.kuboard.cn/layer: monitor

8、如果使用官方镜像站,只要保证本地有对应名字和版本号即可

kubectl apply -f https://kuboard.cn/install-script/kuboard.yaml

eipwork/kuboard:latest

9、查看部署情况

kubectl get pods -n kuboard

10、查看 kuboard 运行情况

➜ Kuboard git:(master) ✗ kubectl get svc -n kuboard

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

kuboard NodePort 10.110.101.148 80:31623/TCP 2m4s

11、设计端口映射访问

➜ Kuboard git:(master) ✗ minikube service kuboard -n kuboard

┌───── ┬──── ┬────── ┬───────────── ┐

│ NAMESPACE │ NAME │ TARGET PORT │ URL │

├───── ┼──── ┼────── ┼───────────── ┤

│ kuboard │ kuboard │ http/80 │ http://192.168.49.2:31623

└───── ┴──── ┴────── ┴───────────── ┘

🏃 为服务 kuboard 启动隧道。/┌───── ┬──── ┬────── ┬────────────┐

│ NAMESPACE │ NAME │ TARGET PORT │ URL │

├───── ┼──── ┼────── ┼────────────┤

│ kuboard │ kuboard │ │ http://127.0.0.1:63366

└───── ┴──── ┴────── ┴────────────┘

🏃 为服务 kuboard 启动隧道。

🎉 正通过默认浏览器打开服务 kuboard/kuboard...

❗ 因为你正在使用 darwin 上的 Docker 驱动程序,所以需要打开终端才能运行它。

12、访问 http://127.0.0.1:63366/dashboard

获取 token

https://www.kuboard.cn/install/install-dashboard.html#获取token

复制代码
# 如果您参考 www.kuboard.cn 提供的文档安装 Kuberenetes,可在第一个 Master 节点上执行此命令
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)
相关推荐
ACP广源盛139246256732 小时前
破局 Type‑C 切换器痛点@ACP#GSV6155+LH3828/GSV2221+LH3828 黄金方案
c语言·开发语言·网络·人工智能·嵌入式硬件·计算机外设·电脑
嵌入式小企鹅4 小时前
蓝牙学习系列(八):BLE L2CAP 协议详解
网络·学习·蓝牙·ble·协议栈·l2cap
handsomestWei4 小时前
Docker引擎API接入配置
运维·http·docker·容器·api
广州灵眸科技有限公司5 小时前
为RK3588注入澎湃算力:RK1820 AI加速卡完整适配与评测指南
linux·网络·人工智能·物联网·算法
byoass5 小时前
csdn_upload_005
网络·安全·云计算
IT WorryFree5 小时前
飞塔防火墙与第三方设备进行IPSEC故障诊断期间,用户可能会观察到以下错误:
linux·服务器·网络
键盘鼓手苏苏7 小时前
Kubernetes与GitOps高级实践
云原生·kubernetes·k8
不是书本的小明7 小时前
K8S应用优化方向
网络·容器·kubernetes
~plus~8 小时前
.NET 8 C# 委托与事件实战教程
网络·c#·.net·.net 8·委托与事件·c#进阶
w6100104669 小时前
CKA-2026-Service
linux·服务器·网络·service·cka