Air-gapped Installation on Kubernetes

    Before you follow the steps below, read Prerequisites first.

    You can use Harbor or any other private image registries. This tutorial uses Docker registry as an example with (If you have your own private image registry, you can skip this step).

    1. Generate your own certificate by executing the following commands:

      1. -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key \
      2. -x509 -days 36500 -out certs/domain.crt
    2. Make sure you specify a domain name in the field Common Name when you are generating your own certificate. For instance, the field is set to dockerhub.kubekey.local in this example.

    Run the following commands to start the Docker registry:

    1. docker run -d \
    2. --restart=always \
    3. --name registry \
    4. -v "$(pwd)"/certs:/certs \
    5. -v /mnt/registry:/var/lib/registry \
    6. -e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
    7. -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
    8. -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
    9. -p 443:443 \
    10. registry:2

    Note

    Docker uses /var/lib/docker as the default directory where all Docker related files, including images, are stored. It is recommended you add additional storage volumes with at least 100G mounted to /var/lib/docker and /mnt/registry respectively. See fdisk command for reference.

    1. Add an entry to /etc/hosts to map the hostname (i.e. the registry domain name; in this case, it is dockerhub.kubekey.local) to the private IP address of your machine as below.

      1. # docker registry
      2. 192.168.0.2 dockerhub.kubekey.local
    2. Execute the following commands to copy the certificate to a specified directory and make Docker trust it.

      1. mkdir -p /etc/docker/certs.d/dockerhub.kubekey.local
      1. cp certs/domain.crt /etc/docker/certs.d/dockerhub.kubekey.local/ca.crt

      Note

      The path of the certificate is related to the domain name. When you copy the path, use your actual domain name if it is different from the one set above.

    Step 2: Prepare Installation Images

    As you install KubeSphere in an air-gapped environment, you need to prepare an image package containing all the necessary images in advance.

    1. Download the image list file images-list.txt from a machine that has access to the Internet through the following command:

      Note

      This file lists images under ##+modulename based on different modules. You can add your own images to this file following the same rule. To view the complete file, see Appendix.

    2. Download offline-installation-tool.sh.

      1. curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.2.0/offline-installation-tool.sh
    3. Make the .sh file executable.

      1. chmod +x offline-installation-tool.sh
    4. You can execute the command ./offline-installation-tool.sh -h to see how to use the script:

      1. [email protected]:/home/ubuntu# ./offline-installation-tool.sh -h
      2. Usage:
      3. ./offline-installation-tool.sh [-l IMAGES-LIST] [-d IMAGES-DIR] [-r PRIVATE-REGISTRY] [-v KUBERNETES-VERSION ]
      4. Description:
      5. -b : save kubernetes' binaries.
      6. -d IMAGES-DIR : the dir of files (tar.gz) which generated by `docker save`. default: ./kubesphere-images
      7. -l IMAGES-LIST : text file with list of images.
      8. -r PRIVATE-REGISTRY : target private registry:port.
      9. -s : save model will be applied. Pull the images in the IMAGES-LIST and save images as a tar.gz file.
      10. -v KUBERNETES-VERSION : download kubernetes' binaries. default: v1.21.5
      11. -h : usage message
    5. Pull images in offline-installation-tool.sh.

      1. ./offline-installation-tool.sh -s -l images-list.txt -d ./kubesphere-images

      Note

      You can choose to pull images as needed. For example, you can delete ##k8s-images and related images under it in images-list.text as you already have a Kubernetes cluster.

    Transfer your packaged image file to your local machine and execute the following command to push it to the registry.

    1. ./offline-installation-tool.sh -l images-list.txt -d ./kubesphere-images -r dockerhub.kubekey.local

    Note

    Step 4: Download Deployment Files

    Similar to installing KubeSphere on an existing Kubernetes cluster in an online environment, you also need to download cluster-configuration.yaml and kubesphere-installer.yaml first.

    1. Execute the following commands to download these two files and transfer them to your machine that serves as the taskbox for installation.

    2. Edit cluster-configuration.yaml to add your private image registry. For example, dockerhub.kubekey.local is the registry address in this tutorial, then use it as the value of .spec.local_registry as below:

      1. spec:
      2. persistence:
      3. storageClass: ""
      4. authentication:
      5. jwtSecret: ""
      6. local_registry: dockerhub.kubekey.local # Add this line manually; make sure you use your own registry address.

      Note

      You can enable pluggable components in this YAML file to explore more features of KubeSphere. Refer to Enable Pluggle Components for more details.

    3. Save cluster-configuration.yaml after you finish editing. Replace ks-installer with your own registry address with the following command:

      1. sed -i "s#^\s*image: kubesphere.*/ks-installer:.*# image: dockerhub.kubekey.local/kubesphere/ks-installer:v3.0.0#" kubesphere-installer.yaml

      Warning

      dockerhub.kubekey.local is the registry address in the command. Make sure you use your own registry address.

    Execute the following commands after you make sure that all steps above are completed.

    1. kubectl apply -f kubesphere-installer.yaml
    2. kubectl apply -f cluster-configuration.yaml

    Step 6: Verify Installation

    When the installation finishes, you can see the content as follows:

    1. #####################################################
    2. ### Welcome to KubeSphere! ###
    3. #####################################################
    4. Console: http://192.168.0.2:30880
    5. Account: admin
    6. Password: [email protected]
    7. 1. After logging into the console, please check the
    8. monitoring status of service components in
    9. the "Cluster Management". If any service is not
    10. ready, please wait patiently until all components
    11. are ready.
    12. 2. Please modify the default password after login.
    13. #####################################################
    14. https://kubesphere.io 20xx-xx-xx xx:xx:xx
    15. #####################################################

    Now, you will be able to access the web console of KubeSphere through http://{IP}:30880 with the default account and password admin/[[email protected]](https://kubesphere.io/cdn-cgi/l/email-protection).

    Note

    kubesphere-login

    1. ##k8s-images
    2. kubesphere/kube-apiserver:v1.22.1
    3. kubesphere/kube-controller-manager:v1.22.1
    4. kubesphere/kube-proxy:v1.22.1
    5. kubesphere/kube-scheduler:v1.22.1
    6. kubesphere/kube-apiserver:v1.21.5
    7. kubesphere/kube-controller-manager:v1.21.5
    8. kubesphere/kube-proxy:v1.21.5
    9. kubesphere/kube-scheduler:v1.21.5
    10. kubesphere/kube-apiserver:v1.20.10
    11. kubesphere/kube-controller-manager:v1.20.10
    12. kubesphere/kube-proxy:v1.20.10
    13. kubesphere/kube-scheduler:v1.20.10
    14. kubesphere/kube-apiserver:v1.19.9
    15. kubesphere/kube-controller-manager:v1.19.9
    16. kubesphere/kube-proxy:v1.19.9
    17. kubesphere/kube-scheduler:v1.19.9
    18. kubesphere/pause:3.5
    19. kubesphere/pause:3.4.1
    20. coredns/coredns:1.8.0
    21. calico/cni:v3.20.0
    22. calico/kube-controllers:v3.20.0
    23. calico/node:v3.20.0
    24. calico/pod2daemon-flexvol:v3.20.0
    25. calico/typha:v3.20.0
    26. kubesphere/flannel:v0.12.0
    27. openebs/provisioner-localpv:2.10.1
    28. openebs/linux-utils:2.10.0
    29. kubesphere/k8s-dns-node-cache:1.15.12
    30. ##kubesphere-images
    31. kubesphere/ks-installer:v3.2.0
    32. kubesphere/ks-apiserver:v3.2.0
    33. kubesphere/ks-console:v3.2.0
    34. kubesphere/ks-controller-manager:v3.2.0
    35. kubesphere/kubectl:v1.20.0
    36. kubesphere/kubefed:v0.8.1
    37. kubesphere/tower:v0.2.0
    38. kubesphere/kubectl:v1.19.1
    39. minio/minio:RELEASE.2019-08-07T01-59-21Z
    40. minio/mc:RELEASE.2019-08-07T23-14-43Z
    41. csiplugin/snapshot-controller:v4.0.0
    42. kubesphere/nginx-ingress-controller:v0.48.1
    43. mirrorgooglecontainers/defaultbackend-amd64:1.4
    44. kubesphere/metrics-server:v0.4.2
    45. redis:5.0.12-alpine
    46. haproxy:2.0.22-alpine
    47. alpine:3.14
    48. osixia/openldap:1.3.0
    49. kubesphere/netshoot:v1.0
    50. ##kubeedge-images
    51. kubeedge/cloudcore:v1.7.2
    52. kubesphere/edge-watcher:v0.1.1
    53. kubesphere/edge-watcher-agent:v0.1.0
    54. ##gatekeeper-images
    55. openpolicyagent/gatekeeper:v3.5.2
    56. ##openpitrix-images
    57. kubesphere/openpitrix-jobs:v3.2.0
    58. ##kubesphere-devops-images
    59. kubesphere/devops-apiserver:v3.2.0
    60. kubesphere/devops-controller:v3.2.0
    61. kubesphere/devops-tools:v3.2.0
    62. kubesphere/ks-jenkins:v3.2.0-2.249.1
    63. jenkins/jnlp-slave:3.27-1
    64. kubesphere/builder-base:v3.2.0
    65. kubesphere/builder-go:v3.2.0
    66. kubesphere/builder-go:v3.2.0
    67. kubesphere/s2ioperator:v3.2.0
    68. kubesphere/s2irun:v3.2.0
    69. kubesphere/s2i-binary:v3.2.0
    70. kubesphere/tomcat85-java11-centos7:v3.2.0
    71. kubesphere/tomcat85-java11-runtime:v3.2.0
    72. kubesphere/tomcat85-java8-centos7:v3.2.0
    73. kubesphere/tomcat85-java8-runtime:v3.2.0
    74. kubesphere/java-11-centos7:v3.2.0
    75. kubesphere/java-8-centos7:v3.2.0
    76. kubesphere/java-8-runtime:v3.2.0
    77. kubesphere/java-11-runtime:v3.2.0
    78. kubesphere/nodejs-8-centos7:v3.2.0
    79. kubesphere/nodejs-6-centos7:v3.2.0
    80. kubesphere/nodejs-4-centos7:v3.2.0
    81. kubesphere/python-36-centos7:v3.2.0
    82. kubesphere/python-35-centos7:v3.2.0
    83. kubesphere/python-34-centos7:v3.2.0
    84. kubesphere/python-27-centos7:v3.2.0
    85. ##kubesphere-monitoring-images
    86. jimmidyson/configmap-reload:v0.3.0
    87. prom/prometheus:v2.26.0
    88. kubesphere/prometheus-config-reloader:v0.43.2
    89. kubesphere/prometheus-operator:v0.43.2
    90. kubesphere/kube-rbac-proxy:v0.8.0
    91. kubesphere/kube-state-metrics:v1.9.7
    92. prom/node-exporter:v0.18.1
    93. kubesphere/k8s-prometheus-adapter-amd64:v0.6.0
    94. prom/alertmanager:v0.21.0
    95. thanosio/thanos:v0.18.0
    96. grafana/grafana:7.4.3
    97. kubesphere/kube-rbac-proxy:v0.8.0
    98. kubesphere/notification-manager-operator:v1.4.0
    99. kubesphere/notification-manager:v1.4.0
    100. kubesphere/notification-tenant-sidecar:v3.2.0
    101. ##kubesphere-logging-images
    102. kubesphere/elasticsearch-curator:v5.7.6
    103. kubesphere/elasticsearch-oss:6.7.0-1
    104. kubesphere/fluentbit-operator:v0.11.0
    105. docker:19.03
    106. kubesphere/fluent-bit:v1.8.3
    107. kubesphere/log-sidecar-injector:1.1
    108. elastic/filebeat:6.7.0
    109. kubesphere/kube-events-operator:v0.3.0
    110. kubesphere/kube-events-exporter:v0.3.0
    111. kubesphere/kube-events-ruler:v0.3.0
    112. kubesphere/kube-auditing-operator:v0.2.0
    113. kubesphere/kube-auditing-webhook:v0.2.0
    114. ##istio-images
    115. istio/pilot:1.11.1
    116. istio/proxyv2:1.11.1
    117. jaegertracing/jaeger-operator:1.27
    118. jaegertracing/jaeger-agent:1.27
    119. jaegertracing/jaeger-collector:1.27
    120. jaegertracing/jaeger-query:1.27
    121. jaegertracing/jaeger-es-index-cleaner:1.27
    122. kubesphere/kiali-operator:v1.38.1
    123. kubesphere/kiali:v1.38
    124. ##example-images
    125. busybox:1.31.1
    126. nginx:1.14-alpine
    127. joosthofman/wget:1.0
    128. nginxdemos/hello:plain-text
    129. wordpress:4.8-apache
    130. mirrorgooglecontainers/hpa-example:latest
    131. java:openjdk-8-jre-alpine
    132. fluent/fluentd:v1.4.2-2.0
    133. perl:latest
    134. kubesphere/examples-bookinfo-productpage-v1:1.16.2
    135. kubesphere/examples-bookinfo-reviews-v1:1.16.2
    136. kubesphere/examples-bookinfo-reviews-v2:1.16.2
    137. kubesphere/examples-bookinfo-details-v1:1.16.2
    138. kubesphere/examples-bookinfo-ratings-v1:1.16.3
    139. ##weave-scope-images