-
Notifications
You must be signed in to change notification settings - Fork 56
Building NGINX Ingress Controller
These instructions will not be maintained. Use k8s.gcr.io/ingress-nginx/controller:v0.40.2@sha256:46ba23c3fbaafd9e5bd01ea85b2f921d9f2217be082580edc22e6c704a83f02f image for Nginx Ingress Controller v0.40.2. Check here for updates on v0.41.2. Refer document here for deployment.
The instructions provided below specify the steps to build NGINX Ingress Controller version 0.27.0 on Linux on IBM Z for following distributions:
- RHEL (7.5, 7.6, 7.7, 8.0, 8.1)
- SLES (12 SP4, 15 SP1)
- Ubuntu (16.04, 18.04, 19.10)
- Kubernetes. For deploying NGINX Ingress Controller, you must have Kubernetes installed. Download Kubernetes binary from Kubernetes.
- Docker packages are provided for SLES, Ubuntu and RHEL (7.5 or higher) in their respective repositories. Instructions for installing Docker on RHEL(7.3) can be found here. You may use the same instructions for RHEL (7.5, 7.6, 7.7) as the binaries are expected to be compatible. More information about Docker CE can be found here.
- At the time of creation of these build instructions NGINX Ingress Controller was verified using Kubernetes version 1.15.1 and Docker 18.06.
General Notes:
- When following the steps below please use a standard permission user unless otherwise specified.
- A directory
/<source_root>/will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
If you want to build nginx-ingress-controller using manual steps, go to STEP 2.
Use the following commands to build nginx-ingress-controller using the build script. Please make sure you have wget and Docker installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/NGINX-ingress-controller/0.27.0/build_nginx-ingress-controller.sh
# Build nginx-ingress-controller
bash build_nginx-ingress-controller.sh [Provide -t option for executing build with tests]
If the build completes successfully, go to STEP 5. In case of error, check logs for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (7.5, 7.6, 7.7)
sudo yum install -y git make curl -
RHEL (8.0, 8.1)
sudo yum install -y git make curl -
SLES (12 SP4, 15, 15 SP1)
sudo zypper install -y git make curl -
Ubuntu (16.04, 18.04, 19.04)
sudo apt-get update sudo apt-get install -y git make golang-1.10 curl export PATH=/usr/lib/go-1.10/bin:$PATH -
Install Go - Instructions for building Go can be found here.
export GOPATH=$SOURCE_ROOT
mkdir -p $GOPATH/src/k8s.io/
cd $GOPATH/src/k8s.io/
git clone https://github.com/kubernetes/ingress-nginx.git
cd ingress-nginx/
git checkout nginx-0.27.0
Apply patch. This patch is needed to build nginx-ingress-controller-s390x docker image.
curl -o nginx_ingress_code_patch.diff https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/NGINX-ingress-controller/0.27.0/patch/nginx_ingress_code_patch.diff
git apply nginx_ingress_code_patch.diff
-
Build nginx image for s390x
cd $GOPATH/src/k8s.io/ingress-nginx/images/nginx/ make container -
Build NGINX Ingress Controller with the nginx image
cd $GOPATH/src/k8s.io/ingress-nginx/ make build containerAfter executing the above steps, these docker images should have been created:
quay.io/kubernetes-ingress-controller/nginx-s390x quay.io/kubernetes-ingress-controller/nginx-ingress-controller-s390xNote: Dockerfile commands used to build the NGINX Ingress Controller docker image requires Docker 18.06+.
- Run test cases
Note: The
cd $GOPATH/src/k8s.io/ingress-nginx/ sudo -E make testk8s.io/ingress-nginx/internal/ingress/controller/storetest currency fails on both x86 and s390x.
-
Patch deployment files
cd $GOPATH/src/k8s.io/ingress-nginx/ wget https://patch-diff.githubusercontent.com/raw/kubernetes/ingress-nginx/pull/4298.diff -O deployment.patch git apply deployment.patchNote: This patch fixes RBAC issues with networking.k8s.io for deployment. It been merged into master and has fixed this issue.
-
Deployment
cd $GOPATH/src/k8s.io/ingress-nginx/ kubectl apply -f deploy/static/mandatory.yaml
POD_NAMESPACE=ingress-nginx
POD_NAME=$(kubectl get pods --all-namespaces | grep nginx-ingress-controller | awk '{print $2}')
kubectl exec -it $POD_NAME -n $POD_NAMESPACE -- /nginx-ingress-controller --version
Output should be:
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: 0.27.0
Build: git-1387f7b7e
Repository: https://github.com/kubernetes/ingress-nginx.git
-------------------------------------------------------------------------------
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.