k8s拉取harbor镜像的时候,配置https就会报错,网上找了好久不知道原因
2条回答 默认 最新
- 专家-司宇[在线] 2024-07-26 20:08关注
引自免费微信小程序:皆我百晓生
要解决这个问题,首先确保您已经正确安装了Kubernetes和Harbor。然后,按照以下步骤操作:
- 首先,删除旧的Secret文件(如果有的话)。
kubectl delete secret harbor-registry-keycloak -n registry
- 创建一个新的Secret文件。
apiVersion: v1 kind: Secret metadata: name: harbor-registry-keycloak type: Opaque data: registry-url: "https://10.15.N2:" username: "admin" password: ""
- 更新您的YAML文件中的
registry_url
、username
和password
字段,并确保它们与您的Harbor配置相匹配。
apiVersion: v1 kind: ConfigMap metadata: name: harbor-config data: url: "https://10.15.N2:" username: "admin" password: "" --- apiVersion: v1 kind: ServiceAccount metadata: name: harbor-admin --- apiVersion: apps/v1 kind: Deployment metadata: name: harbor-deployment spec: replicas: 1 selector: matchLabels: app: harbor template: metadata: labels: app: harbor spec: containers: - name: harbor-container image: harbor/harbor ports: - containerPort: 80 protocol: TCP volumeMounts: - name: harbor-volume mountPath: /var/lib/harbor volumes: - name: harbor-volume hostPath: path: /etc/hosts
- 将上述内容整合到您的YAML文件中,覆盖原始的YAML文件。
apiVersion: kubernetes.config.k8s.io/v1beta1 clusters: kube-system: cluster: server: https://localhost:6443 certFile: /etc/kubernetes/pki/certs/kube-system-client.crt keyFile: /etc/kubernetes/pki/certs/kube-system-client.key default: cluster: server: http://localhost:8080 client: auth: admin cert-file: /etc/kubernetes/pki/ca.crt key-file: /etc/kubernetes/pki/client.pem users: - name: admin groups: - users --- apiVersion: v1 kind: ConfigMap metadata: name: harbor-config data: url: "https://10.15.N2:" username: "admin" password: "" --- apiVersion: apps/v1 kind: Deployment metadata: name: harbor-deployment spec: replicas: 1 selector: matchLabels: app: harbor template: metadata: labels: app: harbor spec: containers: - name: harbor-container image: harbor/harbor ports: - containerPort: 80 protocol: TCP volumeMounts: - name: harbor-volume mountPath: /var/lib/harbor volumes: - name: harbor-volume hostPath: path: /etc/hosts --- apiVersion: v1 kind: Service metadata: name: harbor-service spec: type: LoadBalancer selector: app: harbor ports: - port: 80 targetPort: 80 --- apiVersion: apps/v1 kind: Deployment metadata: name: harbor-deployment spec: replicas: 1 selector: matchLabels: app: harbor template: metadata: labels: app: harbor spec: containers: - name: harbor-container image: harbor/harbor ports: - containerPort: 80 protocol: TCP volumeMounts: - name: harbor-volume mountPath: /var/lib/harbor volumes: - name: harbor-volume hostPath: path: /etc/hosts --- apiVersion: v1 kind: Service metadata: name: harbor-service spec: type: LoadBalancer selector: app: harbor ports: - port: 80 targetPort: 80
-
使用
kubectl apply -f <filename>
命令将更改应用于集群。 -
确保所有相关组件都运行正常。在容器启动时检查其状态。
-
调试HTTPS请求错误。这可能涉及到证书管理或其他环境变量设置的问题。您可以尝试以下步骤来解决此问题:
a. 检查证书是否有效。
b. 检查DNS解析设置。
c. 确保没有其他外部服务器阻塞了请求。
-
如果问题仍然存在,请提供更多关于环境细节的信息,以便更准确地定位问题。
解决 无用评论 打赏 举报 编辑记录
悬赏问题
- ¥30 stm32f103c8t6制作万能红外遥控器
- ¥15 有人会fastcrud写前端页面吗
- ¥15 如何解除Uniaccess管控
- ¥15 微信小程序跳转关联公众号
- ¥15 Java AES 算法 加密采用24位向量报错如何处理?
- ¥15 使用X11可以找到托盘句柄,监控到窗口点击事件但是如何在监听的同时获取托盘中应用的上下文菜单句柄
- ¥45 字符串操作——数组越界问题
- ¥15 Loss下降到0.08时不在下降调整学习率也没用
- ¥15 QT+FFmpeg使用GPU加速解码
- ¥15 为什么投影机用酷喵播放电影放一段时间就播放不下去了?提示发生未知故障,有什么解决办法吗?