Skip to content

Commit

Permalink
fix: Install Istio using Marketplace
Browse files Browse the repository at this point in the history
fixes: 206
  • Loading branch information
kameshsampath authored and saiyam1814 committed Jun 13, 2021
1 parent f779e14 commit f296294
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 0 deletions.
18 changes: 18 additions & 0 deletions istio/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: istio-ingressgateway-ingress
namespace: istio-system
spec:
rules:
- host: istio.$CLUSTER_ID.k8s.civo.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: istio-ingressgateway
port:
number: 80
31 changes: 31 additions & 0 deletions istio/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -eu
set -o pipefail

ISTIO_NS=istio-system

if [ "$ISTIO_VERSION" == "latest" ];
then
ISTIO_VERSION=$(curl -sSL https://api.github.com/repos/istio/istio/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "Downloading latest Istio: v$ISTIO_VERSION"
curl -L https://istio.io/downloadIstio | sh -
else
echo "Downloading Istio: v$ISTIO_VERSION"
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=$ISTIO_VERSION sh -
fi

# TODO enable this once we are able to get the ISTIO_VERSION in sh
#curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.10.0 sh -

ISTIO_DIR=$(find . -name istio*)
export PATH=$ISTIO_DIR/bin:$PATH

# # Run prechecks
istioctl x precheck

# # Install Istio Demo Profile
istioctl install --set profile=demo -y

# Create the Ingress Gateway for istio-ingressgateway
kubectl apply -n $ISTIO_NS https://raw.githubusercontent.com/civo/kubernetes-marketplace/master/istio/ingress.yaml
Binary file added istio/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions istio/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: istio
title: "Istio Service Mesh"
version: "1.10.0"
maintainer: kamesh.sampath@hotmail.com
description: Simplify observability, traffic management, security, and policy with the leading service mesh.
url: https://istio.io/latest/
category: architecture
plans:
- label: "Istio Latest"
configuration:
ISTIO_VERSION:
value: latest
- label: "Istio v1.10.0"
configuration:
ISTIO_VERSION:
value: 1.10.0
configuration:
CLUSTER_ID:
label: "Cluster ID"
value: "CIVO:CLUSTER_ID"
76 changes: 76 additions & 0 deletions istio/post_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
## The Istio service mesh

[Istio](https://istio.io) addresses the challenges developers and operators face with a distributed or microservices architecture. Whether you're building from scratch or migrating existing applications to cloud native, Istio can help.

### Install istioctl

Download and Install latest `istioctl` in your local machine:

```shell
curl -L https://istio.io/downloadIstio | sh -
ISTIO_DIR=$(find . -name istio*)
export PATH=$ISTIO_DIR/bin:$PATH
cd $ISTIO_DIR
```

### Get started

### Access Istio Ingress Gateway

The installation creates an *Ingress* for the `istio-ingressgateway`. You can use that to access the Istio service mesh applications.

Run the following command to get Istio Ingress Gateway URL:

```shell
export ISTIO_GATEWAY_URL=$(kubectl get ing -n istio-system istio-ingressgateway-ingress -o=jsonpath='{.spec.rules[0].host}')
curl -I $ISTIO_GATEWAY_URL
```

The command should show an output with HTTP 502, as currently no application is part of the Istio Service mesh.

```text
HTTP/1.1 502 Bad Gateway
Vary: Accept-Encoding
Date: Wed, 26 May 2021 12:39:35 GMT
Content-Length: 11
Content-Type: text/plain; charset=utf-8
```

Label the `default` namespace for Istio automatic sidecar injection:

```shell
kubectl label namespace default istio-injection=enabled
```

Now deploy [Deploy Bookinfo Application](https://istio.io/latest/docs/setup/getting-started/#bookinfo)

Once successfully deployed, [expose the application](https://istio.io/latest/docs/setup/getting-started/#bookinfo) to outside world

After you have exposed the application to outside world, try accessing it using the `$GATEWAY_URL`

```shell
curl -I $ISTIO_GATEWAY_URL/productpage
```
The curl should return you an HTTP 200

```text
HTTP/1.1 200 OK
Content-Length: 5179
Content-Type: text/html; charset=utf-8
Date: Wed, 26 May 2021 12:47:06 GMT
Server: istio-envoy
Vary: Accept-Encoding
X-Envoy-Upstream-Service-Time: 1029
```

(OR)

Opening the following url in the web browser should show you the sample book application landing page:

```shell
open "http://$ISTIO_GATEWAY_URL/productpage"
```

### Documentation

[Istio Documentation](https://istio.io/latest/docs/)
26 changes: 26 additions & 0 deletions istio/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -eu
set -o pipefail

ISTIO_NS=istio-system

if [ "$ISTIO_VERSION" == "latest" ];
then
unset ISTIO_VERSION
curl -L https://istio.io/downloadIstio | sh -
else
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=$ISTIO_VERSION sh -
fi

ISTIO_DIR=$(find . -name istio*)
export PATH=$ISTIO_DIR/bin:$PATH

kubectl config set-context --current --namespace=$ISTIO_NS

# Delete Istio
istioctl manifest generate --set profile=demo |\
kubectl delete -n$ISTIO_NS --ignore-not-found=true -f -

# Set context namespace back to "default"
kubectl config set-context --current --namespace=default

0 comments on commit f296294

Please sign in to comment.