Skip to content

Istio with k8s 1.0.0 release

Guirish Salgaonkar edited this page Aug 29, 2018 · 3 revisions

Integrating Istio with Kubernetes

Istio is used as an open platform to connect, manage, and secure microservices in kubernetes cluster across the cloud. The DRAFT instructions provided below specify the steps to integrate Istio(v1.0.0) with Kubernetes on Linux on IBM Z for following distribution:

  • RHEL (7.3, 7.4, 7.5)
  • SLES 12 SP3
  • Ubuntu (16.04, 18.04)

General Notes:

  • Below steps should be performed as root user.

Prerequisites:

  • Istioctl and its associated binaries -- Instructions for building can be found here
  • Docker
    • RHEL (7.3, 7.4, 7.5)
      • Instructions for installation of Docker for Rhel (7.3, 7.4, 7.5) can be found here.
    • SLES 12 SP3
      • Instructions for installation of Docker for SLES 12 SP3 can be found here.
    • Ubuntu (16.04, 18.04)
      • Instructions for installation of Docker for Ubuntu (16.04, 18.04) can be found here.

Note: Docker-ce versions between 17.06 and 18.02 have a known issue on IBM Z. This has been fixed in version 18.03, refer to docker release link for most up to date information on which another version might contain this fix.

1. Build Istio component Images

1.1) Set below env variables:

export GOPATH=/<Directory mapped as per $GOPATH from Istio build steps>/
export PATH=$PATH:$GOPATH/bin

1.2) Build prometheus/statsd-exporter image

  • Build quay.io/prometheus/s390x/busybox image which is referred while building prom/statsd-exporter
cd $GOPATH
git clone https://github.com/prometheus/busybox $GOPATH/src/github.com/prometheus/busybox
cd $GOPATH/src/github.com/prometheus/busybox
git checkout "dcd9ab1e7e561b290cb32ce444d21a8c90605300"
  • Modify Makefile
@@ -12,10 +12,10 @@
 # limitations under the License.

REPOSITORY := quay.io/prometheus
-NAME       := busybox
+NAME       := s390x/busybox
BRANCH     := $(shell git rev-parse --abbrev-ref HEAD)
SUFFIX     ?= -$(subst /,-,$(BRANCH))
-VERSIONS   ?= uclibc glibc
+VERSIONS   ?= glibc
all: build
  • Modify glibc/Dockerfile
@@ -1,4 +1,4 @@
-FROM debian:stretch
+FROM s390x/debian:stretch

 RUN \
     apt-get update && apt-get install -y --no-install-recommends \
@@ -27,7 +27,7 @@ RUN set -x \
         fi; \
     done

-FROM        busybox:glibc
+FROM        s390x/busybox:glibc
 MAINTAINER  The Prometheus Authors <prometheus-developers@googlegroups.com>

 COPY --from=0 /rootfs /
  • Build image
make build
  • Build promethues/statsd_exporter binaries
git clone https://github.com/prometheus/statsd_exporter $GOPATH/src/github.com/prometheus/statsd_exporter
cd $GOPATH/src/github.com/prometheus/statsd_exporter
git checkout v0.6.0
go build
  • Modify the Dockerfile
@@ -1,4 +1,4 @@
-FROM        quay.io/prometheus/busybox:latest
+FROM        quay.io/prometheus/s390x/busybox:glibc-HEAD
MAINTAINER  The Prometheus Authors <prometheus-developers@googlegroups.com>
  • Build promethues/statsd_exporter image
make docker
docker tag statsd-exporter:HEAD prom/statsd-exporter:v0.6.0
docker tag statsd-exporter:HEAD prom/statsd-exporter:latest

1.3) Build prometheus image

cd $GOPATH
  • Create Dockerfile.prometheus with below contents:

    FROM s390x/ubuntu:16.04
    ENV GOPATH=/go PATH=/usr/lib/go-1.10/bin:$PATH:/go/bin:/prometheus	
    RUN apt-get update && apt-get install -y \
    	cmake \
    	curl \
    	gcc \
    	git \
    	g++ \
    	make \
    	tar \
    	wget \
    	golang-1.10 \
    
     && mkdir -p $GOPATH/src/github.com/prometheus \
     && cd $GOPATH/src/github.com/prometheus \
     && git clone git://github.com/prometheus/prometheus.git \
     && cd prometheus \
     && git checkout v2.3.1 \
     && make build \
     && mkdir -p /prometheus && mkdir -p /etc/prometheus \
     && cp prometheus /bin/prometheus && cp promtool /bin/promtool \
     && cp -p documentation/examples/prometheus.yml /etc/prometheus/prometheus.yml \
     && chmod +x /etc/prometheus/prometheus.yml \
     && cp -Rf console_libraries /etc/prometheus/ \
     && cp -Rf consoles /etc/prometheus/ \
     && rm -rf /go/src/github.com \
    #Export port 9090
    EXPOSE 9090
    VOLUME     [ "/prometheus" ]
    WORKDIR    /prometheus
    ENTRYPOINT [ "/bin/prometheus" ]
    CMD        [ "--config.file=/etc/prometheus/prometheus.yml", \
    			 "--storage.tsdb.path=/prometheus", \
    			 "--web.console.libraries=/usr/share/prometheus/console_libraries", \
    			 "--web.console.templates=/usr/share/prometheus/consoles" ]
     

    Build docker image:

    docker build -t prom/prometheus:latest -f Dockerfile.prometheus .
    docker tag prom/prometheus prom/prometheus:v2.3.1

1.4) Build Grafana image

cd $GOPATH
  • Create Dockerfile.grafana with below contents:

    	FROM s390x/ubuntu:16.04
    	ENV QT_QPA_PLATFORM=offscreen GOPATH=/opt
    	ENV PATH=$PATH:/opt/yarn-v1.3.2/bin:$GOPATH/bin:/opt/ibm/node/bin:/usr/lib/go-1.10/bin:/usr/share/grafana/bin/linux-s390x
    	RUN apt-get update -y && apt-get install -y \
    		build-essential \
    		gcc \
    		git \
    		make \
    		phantomjs \
    		python \
    		wget \
    		unzip \
    		golang-1.10 \
    	 && cd / && wget http://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-s390x.tar.xz \
    	 && chmod ugo+r node-v8.11.3-linux-s390x.tar.xz \
    	 && tar -C /usr/local -xf node-v8.11.3-linux-s390x.tar.xz \
    	 && export PATH=$PATH:/usr/local/node-v8.11.3-linux-s390x/bin \
    	 && cd / && git clone https://github.com/grafana/grafana.git $GOPATH/src/github.com/grafana/grafana \
    	 && cd $GOPATH/src/github.com/grafana/grafana && git checkout v5.2.0 \
    	 && make deps-go \
    	 && make build-go \
    	 && cd / && wget https://github.com/yarnpkg/yarn/releases/download/v1.3.2/yarn-v1.3.2.tar.gz \
    	 && tar -C /opt/ -xzf yarn-v1.3.2.tar.gz \
    	 && rm -rf /yarn-v1.3.2.tar.gz \
    	 && cd $GOPATH/src/github.com/grafana/grafana \
    	 && npm install grunt \
    	 && make deps-js \
    	 && make build-js \
    	 && cp -Rf $GOPATH/src/github.com/grafana/grafana /usr/share/ \
    	 && apt-get remove -y \
    		build-essential \
    		gcc \
    		git \
    		make \
    		phantomjs \
    		python \
    		wget \
    		unzip \
    	 && apt autoremove -y \
    	 && apt-get clean && rm -rf /var/lib/apt/lists/*  $GOPATH/src/github.com  /node-v8.11.3-linux-s390x
    	VOLUME ["/usr/share/grafana/conf","/usr/share/grafana/data"]
    	EXPOSE 3000
    	WORKDIR "/usr/share/grafana/"
    	ENTRYPOINT grafana-server start

    Build docker image: docker build -t grafana/grafana:5.0.4 -f Dockerfile.grafana .

1.5) Build Hyperkube image

docker pull k8s.gcr.io/hyperkube-s390x:v1.10.5
docker tag k8s.gcr.io/hyperkube-s390x:v1.10.5 quay.io/coreos/hyperkube:v1.7.6_coreos.0

1.6) Modify Dockerfiles to use s390x base image:

cd $GOPATH/src/istio.io/istio

Dockerfiles to Modify:

   addons/servicegraph/docker/Dockerfile.servicegraph_debug
   docker/Dockerfile.xenial_debug
   mixer/docker/Dockerfile.mixer_debug
   pilot/docker/Dockerfile.proxy_init
   security/docker/Dockerfile.node-agent-test
   security/docker/Dockerfile.citadel-test
  • On Ubuntu 16.04
-FROM ubuntu:xenial
+FROM s390x/ubuntu:16.04
  • On RHEL, SLES and Ubuntu 18.04
-FROM ubuntu:xenial
+FROM s390x/ubuntu:18.04

1.7) Build istionightly/base_debug image

cd $GOPATH/src/istio.io/istio/docker 
docker build -t istionightly/base_debug:latest -f Dockerfile.xenial_debug .

1.8) Build remaining images

cd $GOPATH/src/istio.io/istio/ 
make docker

2. Kubernetes local cluster setup with Istio

2.1) Setup local kubernetes cluster

Note: Perform below steps as root user

  • You must have Kubernetes 1.9 or newer cluster with RBAC (Role-Based Access Control) enabled. You should also have a local configured copy of kubectl. Download Kubernetes binary from Kubernetes. At the time of creation of these build instructions Istio was verified using Kubeadm v1.9.9.
  • Start kubernetes cluster using kubeadm init --pod-network-cidr=10.244.0.0/16

2.2) Istio integration with Kubernetes

cd $GOPATH/src/istio.io/istio
./install/updateVersion.sh
  • Run istio.yaml and verify if all the istio pods are in running state.
kubectl apply -f ./install/kubernetes/istio.yaml
kubectl get pods -n istio-system
  • You should get output in following form
  NAME                                        READY     STATUS      RESTARTS   AGE
  istio-citadel-7ddb54dfbc-q7bhx              1/1       Running     0          3d
  istio-cleanup-secrets-qk5mq                 0/1       Completed   0          3d
  istio-egressgateway-76f784dd5c-frlzw        1/1       Running     0          3d
  istio-galley-55566b4f94-r8vsd               1/1       Running     0          3d
  istio-ingressgateway-7869d4b548-bl5s4       1/1       Running     0          3d
  istio-pilot-df54f4986-9674s                 2/2       Running     0          3d
  istio-policy-6779c65444-gmc5j               2/2       Running     0          3d
  istio-sidecar-injector-9469b45f7-2548c      1/1       Running     0          3d
  istio-statsd-prom-bridge-55965ff9c8-qbfgk   1/1       Running     0          3d
  istio-telemetry-5df95c6d57-fwnhm            2/2       Running     0          3d
  prometheus-7456f56c96-5rqdk                 1/1       Running     0          3d

3. Usage samples

The demos of the simple usage of Istio with Kubernetes can be found at

So far the Istio Ingress demo has been verified on s390x with Kubernetes v1.9.9 version when the porting was conducted. Also note that all images used in the demo should be s390x compatible. Images pulled directly from the Internet cannot be used for s390x, using them on Linux on IBM Z will lead to errors.