Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kk 安装kubesphere3.4.1,使用已有的harbor 镜像仓库,k8s安装部分拉取了该仓库中的镜像,kubesphere安装部分确从官方镜像仓库拉取 #2297

Open
junlintianxiazhifulinzhongguo opened this issue Jun 27, 2024 · 0 comments

Comments

@junlintianxiazhifulinzhongguo
Copy link

junlintianxiazhifulinzhongguo commented Jun 27, 2024

我将安装所需的所有镜像都推送到了自己的harbor 镜像仓库,以下是集群 配置文件中的相关配置

apiVersion: kubekey.kubesphere.io/v1alpha2
kind: Cluster
metadata:
  name: sample
spec:
  hosts:
  - {name: k8s-master-01, address: 192.168.5.111, internalAddress: 192.168.5.111, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: k8s-master-02, address: 192.168.5.112, internalAddress: 192.168.5.112, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: k8s-master-03, address: 192.168.5.113, internalAddress: 192.168.5.113, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: k8s-work-01, address: 192.168.5.114, internalAddress: 192.168.5.114, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: k8s-work-02, address: 192.168.5.115, internalAddress: 192.168.5.115, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: k8s-work-03, address: 192.168.5.116, internalAddress: 192.168.5.116, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: k8s-work-04, address: 192.168.5.117, internalAddress: 192.168.5.117, privateKeyPath: "~/.ssh/id_rsa"}
  - {name: k8s-work-05, address: 192.168.5.118, internalAddress: 192.168.5.118, privateKeyPath: "~/.ssh/id_rsa"}
  roleGroups:
    etcd:
    - k8s-master-01
    - k8s-master-02
    - k8s-master-03
    control-plane:
    - k8s-master-01
    - k8s-master-02
    - k8s-master-03
    worker:
    - k8s-work-01
    - k8s-work-02
    - k8s-work-03
    - k8s-work-04
    - k8s-work-05
  controlPlaneEndpoint:
    ## Internal loadbalancer for apiservers
    internalLoadbalancer: haproxy

    domain: lb.kubesphere.local
    address: ""
    port: 6443
  system:
    # The ntp servers of chrony.
    ntpServers:
    - ntp.aliyun.com
    timezone: "Asia/Shanghai"
  kubernetes:
    version: v1.23.17
    clusterName: cluster.local
    autoRenewCerts: true
    containerManager: docker
    maxPods: 110
    proxyMode: ipvs
  etcd:
    type: kubekey
  network:
    plugin: calico
    kubePodsCIDR: 10.233.64.0/18
    kubeServiceCIDR: 10.233.0.0/18
    ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni
    multusCNI:
      enabled: false
  storage:
    openebs:
      basePath: /var/openebs/local
  registry:
    auths:
      "harbor.lichengjun.top":
        username: admin
        password: Dev-Ops@2024
    privateRegistry: "harbor.lichengjun.top"
    namespaceOverride: "kubesphereio"
    registryMirrors: []
    insecureRegistries: ["harbor.lichengjun.top"]
  addons: []



---
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:
  name: ks-installer
  namespace: kubesphere-system
  labels:
    version: v3.4.1
spec:
  persistence:
    storageClass: ""
  authentication:
    adminPassword: "Yztx@2023"
    jwtSecret: ""
  zone: "Asia/Shanghai"
  local_registry: "harbor.lichengjun.top/kubesphereio"
  dev_tag: ""

下面是安装效果

[root@k8s-master-01 ~]# kubectl get pods -o yaml -n kube-system                    kube-apiserver-k8s-master-01 | grep image
    image: harbor.lichengjun.top/kubesphereio/kube-apiserver:v1.23.17
    imagePullPolicy: IfNotPresent
    image: harbor.lichengjun.top/kubesphereio/kube-apiserver:v1.23.17
    imageID: docker-pullable://harbor.lichengjun.top/kubesphereio/kube-apiserver@sha256:c9113ef6f272f89e9a7a3eefb0f66dadcaad13f52ffc58a805b2bb236e2e5fed
[root@k8s-master-01 ~]#
[root@k8s-master-01 ~]#
[root@k8s-master-01 ~]# kubectl get pods -o yaml -n kubesphere-system              ks-apiserver-647c688448-74t5p   | grep image
    image: registry.cn-beijing.aliyuncs.com/kubesphereio/ks-apiserver:v3.4.1
    imagePullPolicy: Always
  - image: registry.cn-beijing.aliyuncs.com/kubesphereio/ks-apiserver:v3.4.1
    imageID: ""

在安装前,如何配置 imagePullPolicy 策略,我看有些镜像总是拉取,我想设置成本地有就不用拉取

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant