Introduction
To perform an installation without the system needing access to the internet, a local HTTP repository must be created and provisioned with the necessary files. These files are used to provide the binaries for Kubernetes installation, as well as the Helm charts used during Common Services installation.
$ docker run --name mynginx1 -p <port>:<port> -d nginx
More information can be found out on configuring and installing Nginx u sing docker here: https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-docker/
OR
Use the html directory of Apache http server created during setting up yum mirror to perform the tasks listed below. Note: Create new directories for kubernetes binaries and helm charts in html folder
Procedure Steps
Table A-3 Steps to configure OCCNE HTTP Repository
Steps | Procedure | Description |
---|---|---|
1.
|
Retrieve Kubernetes Binaries |
The Kubernetes installer requires access to an HTTP server from which it can download the proper version of a set of binary files. To provision an internal HTTP repository one will need to obtain these files from the internet, and place them at a known location on the internal HTTP server. The following script will retrieve the proper binaries and place them in a directory named 'binaries' under the command-line specified directory. This 'binaries' directory needs to then be placed on the HTTP server where it can be served up, with the URL identified in the clusters hosts.ini inventory file (see below). deploy/retrieve_k8s_bins.sh #!/bin/bash ################################################################################ # # # Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. # # # ################################################################################ usage() { echo "Retrieve kubespray binaries for a private HTTP repo." 2>&1 echo "Expected 1 argument: webroot-directory " 2>&1 exit 1 } [[ "$#" -ne "1" ]] && usage # # Kubespray Binaries kube_version='v1.12.5' # k8s_install/kubespray/roles/download/defaults/main.yaml kubeadm_version=$kube_version # k8s_install/kubespray/roles/download/defaults/main.yaml image_arch='amd64' # k8s_install/kubespray/roles/download/defaults/main.yaml etcd_version='v3.2.24' # k8s_install/kubespray/roles/download/defaults/main.yaml cni_version='v0.6.0' # k8s_install/kubespray/roles/download/defaults/main.yaml startdir=$pwd mkdir -p $1/binaries/$kube_version wget -P $1/binaries/$kube_version https://storage.googleapis.com/kubernetes-release/release/${kubeadm_version}/bin/linux/${image_arch}/kubeadm wget -P $1/binaries/$kube_version https://storage.googleapis.com/kubernetes-release/release/${kube_version}/bin/linux/amd64/hyperkube wget -P $1/binaries https://github.com/coreos/etcd/releases/download/${etcd_version}/etcd-${etcd_version}-linux-amd64.tar.gz wget -P $1/binaries https://github.com/containernetworking/plugins/releases/download/$cni_version/cni-plugins-${image_arch}-${cni_version}.tgz |
2.
|
Run the script |
$ retrieve_k8s_bins.sh <directoryname> |
3.
|
Retrieve Helm binaries and charts |
The Configuration installer requires access to an HTTP server from which it can download the proper version of a set of Helm charts for the common services. To provision an internal HTTP repository one will need to obtain these charts from the internet, and place them at a known location on the internal HTTP server. deploy/helm_images.txt ################################################################################ # # # Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. # # # ################################################################################ # chart-name chart-version stable/elasticsearch 1.27.2 stable/elasticsearch-curator 1.2.1 stable/elasticsearch-exporter 1.1.2 stable/fluentd-elasticsearch 2.0.7 stable/grafana 3.3.8 stable/kibana 3.0.0 stable/metallb 0.8.4 stable/prometheus 8.8.0 stable/prometheus-node-exporter 1.3.0 stable/metrics-server 2.5.1 incubator/jaeger 0.8.3 # this one is part of the configure code-base, so not pulled. There is an image associated in the docker image repo. # storage/occne-local/helm/provisioner 2.3.0 |
4.
|
Retrieve the proper Helm binary |
The following script will retrieve the proper Helm binary, run it to retrieve the necessary charts, and place them in a directory named 'charts' under the command-line specified directory. This 'charts' directory needs to then be placed on the HTTP server where it can be served up, with the URL identified in the clusters hosts.ini inventory file (see below). deploy/retrieve_helm.sh #!/bin/bash ################################################################################ # # # Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. # # # ################################################################################ usage() { echo "Retrieve helm charts for a private HTTP repo." 2>&1 echo "Expected 1 argument: webroot-directory " 2>&1 echo "run with image list piped in: $0 webroot-directory < helm_images.txt" 2>&1 exit 1 } [[ "$#" -ne "1" ]] && usage startdir=$pwd mkdir -p $1/charts # helm_version='v2.11.0' # k8s_install/kubespray/roles/download/defaults/main.yaml configure/readme.md helm_version='v2.9.1' # configure/Dockerfile (and in environment) # retrieve the helm binary wget https://storage.googleapis.com/kubernetes-helm/helm-${helm_version}-linux-amd64.tar.gz # extract helm to ./helm/ tar -xvf helm-${helm_version}-linux-amd64.tar.gz rm -f helm-${helm_version}-linux-amd64.tar.gz mv linux-amd64 helm cd helm # initialize helm, add repositories, and update helm init --client-only helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ helm repo add kiwigrid https://kiwigrid.github.io helm repo update # fetch archives of helm charts and place them in the proper directory for the local HTTP repository HELMCHART_DIR=$1/charts echo "fetching charts..." # regular expression to match for valid line (variable as in-line regex is sometimes parsed differently in different bash versions) re='^(\S+)\s+(\S+)' while read line; do if [[ ${line} =~ ^'#'(.*) ]]; then # comment, just echo it echo "${BASH_REMATCH[0]}" elif [[ ${line} =~ ^'`'(.*) ]]; then # markdown code delimiter, ignore : elif [[ ${line} =~ ${re} ]]; then echo "Retrieving chart='${BASH_REMATCH[1]}' version='${BASH_REMATCH[2]}'" helm fetch ${BASH_REMATCH[1]} --version=${BASH_REMATCH[2]} -d ${HELMCHART_DIR} fi done echo "completed fetching charts" cd $startdir |
5.
|
Run the script |
$ retrieve_helm.sh <directoryname> <helm_images>.txt |
6.
|
Update inventory file with URLs | The
hosts.ini inventory file for the cluster needs to have a few variables
set in the [occne:vars] section to direct the installation logic to the
repository directories populated above. In this example the http server is
winterfell on port 8082.
Note: the helm repo has a trailing / the k8s repo does NOT. hosts.ini ... [occne:vars] ... occne_k8s_binary_repo='http://winterfell:8082/binaries' occne_helm_stable_repo_url='http://winterfell:8082/charts/' ... |