1、删除kubesphere内置应用仓库

kubectl delete helmrepos builtin-stable

2、清空内置仓库中的apps

kubectl get helmapplications |awk ‘{ print $1 }’ |grep -v NAME |xargs kubectl delete helmapplications

现在应用商店内的app被清空了,但如果ks-installer重启,内置应用商店和app还会再出现;

3、创建修剪得openpitrix import job 的task

---

kind: ConfigMap

apiVersion: v1

metadata:

name: ks-installer-openpitrix-task

namespace: kubesphere-system

annotations:

kubesphere.io/creator: admin

data:

main.yaml: |

---

- name: OpenPitrix | Getting OpenPitrix jobs files

copy:

src: "openpitrix"

dest: "{{ kubesphere_dir }}/"

- name: OpenPitrix | Getting OpenPitrix jobs files

template:

src: "{{ item.file }}.j2"

dest: "{{ kubesphere_dir }}/{{ item.path }}/{{ item.file }}"

with_items:

- { path: openpitrix, file: ks-openpitrix-import.yaml }

- { path: openpitrix, file: builtin-repo.yaml }

- name: OpenPitrix | Check OpenPitrix v3.0.0

shell: >

{{ bin_dir }}/kubectl get deploy openpitrix-hyperpitrix-deployment -n openpitrix-system 2>1 -oNAME | wc -l

register: openpitrix_deploy_count

4、将这个cm挂载到ks-installer,覆盖原有的task文件

spec:

  volumes:

    - name: host-time

      hostPath:

        path: /etc/localtime

        type: ''

    - name: volume-rsjffp

      configMap:

        name: ks-installer-openpitrix-task

        defaultMode: 420

    - name: kube-api-access-x4fdv

      projected:

        sources:

          - serviceAccountToken:

              expirationSeconds: 3607

              path: token

          - configMap:

              name: kube-root-ca.crt

              items:

                - key: ca.crt

                  path: ca.crt

          - downwardAPI:

              items:

                - path: namespace

                  fieldRef:

                    apiVersion: v1

                    fieldPath: metadata.namespace

        defaultMode: 420

  containers:

    - name: installer

      image: 'hub.registry2.com:32005/kubesphere/ks-installer:v3.2.0'

      resources:

        limits:

          cpu: '1'

          memory: 1Gi

        requests:

          cpu: 20m

          memory: 100Mi

      volumeMounts:

        - name: host-time

          readOnly: true

          mountPath: /etc/localtime

        - name: volume-rsjffp

          readOnly: true

          mountPath: /kubesphere/installer/roles/openpitrix/tasks