-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Istio * Dockerfile updated for devcontainer * Documents updated * Istio namespaces creating added * Documentation improved * Hub address added to profile configuration file * Istio added to local registry * HowTo updated and task with deploying istio improved * HowTo doc improved * Correct verb form * Small changes in HowTo doc and DockerFile Co-authored-by: to-bar <[email protected]>
- Loading branch information
1 parent
8fc85cd
commit 59a2ad0
Showing
14 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...n/ansible/playbooks/roles/applications/tasks/applications/istio/deploy-istio-operator.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
|
||
- name: Decide if internal docker registry will be used | ||
set_fact: | ||
use_epiphany_image_registry: >- | ||
{{ (not _k8s_as_cloud_service) and _use_local_image_registry }} | ||
vars: | ||
# Be extra paranoid | ||
_k8s_as_cloud_service: >- | ||
{{ k8s_as_cloud_service | bool }} | ||
# Enable by default | ||
_use_local_image_registry: >- | ||
{{ (data.use_local_image_registry is undefined) or (data.use_local_image_registry | bool) }} | ||
- name: Init istio operator | ||
command: istioctl operator init {{ _init_args | join(' ') }} | ||
vars: | ||
_common_args: | ||
- --istioNamespace={{ data.namespaces.istio }} | ||
- --operatorNamespace={{ data.namespaces.operator }} | ||
- --watchedNamespaces={{ data.namespaces.watched | join(',') }} | ||
_hub_arg: --hub={{ image_registry_address }}/istio | ||
_init_args: >- | ||
{{ _common_args + [ _hub_arg ] if (use_epiphany_image_registry) else | ||
_common_args }} |
9 changes: 9 additions & 0 deletions
9
...epicli/data/common/ansible/playbooks/roles/applications/tasks/applications/istio/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
- name: Deploy Istio operator | ||
include_tasks: deploy-istio-operator.yml | ||
|
||
- name: Deploy Istio | ||
include_tasks: deploy-k8s-app.yml | ||
vars: | ||
app_dir_name: "{{ data.name }}" |
14 changes: 14 additions & 0 deletions
14
...icli/data/common/ansible/playbooks/roles/applications/templates/istio/00-namespace.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% for namespace in data.namespaces.watched %} | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: {{ namespace }} | ||
{% endfor %} | ||
{% if data.namespaces.istio not in data.namespaces.watched %} | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: {{ data.namespaces.istio }} | ||
{% endif %} |
14 changes: 14 additions & 0 deletions
14
...epicli/data/common/ansible/playbooks/roles/applications/templates/istio/01-profile.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
apiVersion: install.istio.io/v1alpha1 | ||
kind: IstioOperator | ||
metadata: | ||
namespace: {{ data.namespaces.watched[0] }} | ||
name: {{ data.istio_spec.name }} | ||
spec: | ||
profile: {{ data.istio_spec.profile }} | ||
{% if use_epiphany_image_registry %} | ||
hub: {{ image_registry_address }}/istio | ||
{% endif %} | ||
values: | ||
global: | ||
istioNamespace: {{ data.namespaces.istio }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
## Istio | ||
|
||
Open source platform which allows you to run service mesh for distributed microservice architecture. It allows to connect, manage and run secure connections between microservices and brings lots of features such as load balancing, monitoring and service-to-service authentication without any changes in service code. Read more about Istio [here](https://istio.io/latest/docs/concepts/what-is-istio/). | ||
|
||
### Installing Istio | ||
|
||
Istio in Epiphany is provided as K8s application. By default, it is not installed. To deploy it you need to add "configuration/applications" document to your configuration yaml file, similar to the example below (`enabled` flag must be set as `true`): | ||
|
||
Istio is installed using Istio Operator. Operator is a software extension to the Kubernetes API which has a deep knowledge how Istio deployments should look like and how to react if any problem appears. It is also very easy to make upgrades and automate tasks that would normally be executed by user/admin. | ||
|
||
```yaml | ||
--- | ||
kind: configuration/applications | ||
version: 0.8.0 | ||
title: "Kubernetes Applications Config" | ||
provider: aws | ||
name: default | ||
specification: | ||
applications: | ||
... | ||
|
||
## --- istio --- | ||
|
||
- name: istio | ||
enabled: true | ||
use_local_image_registry: true | ||
namespaces: | ||
operator: istio-operator # namespace where operator will be deployed | ||
watched: # list of namespaces which operator will watch | ||
- istio-system | ||
istio: istio-system # namespace where Istio control plane will be deployed | ||
istio_spec: | ||
profile: default # Check all possibilites https://istio.io/latest/docs/setup/additional-setup/config-profiles/ | ||
name: istiocontrolplane | ||
|
||
``` | ||
|
||
Using this configuration file, controller will detect Istio Operator resource in first of watched namespaces and will install Istio components corresponding to the specified profile (default). Using the default profile, Istio control plane and Istio ingress gateway will be deployed in istio-system namespace. | ||
|
||
### How to set up service mesh for an application | ||
|
||
The default Istio installation uses automcatic sidecar injection. You need to label the namespace where application will be hosted: | ||
|
||
```bash | ||
kubectl label namespace default istio-injection=enabled | ||
``` | ||
|
||
Once the proper namespaces are labeled and Istio is deployed, you can deploy your applications or restart existing ones. | ||
|
||
You may need to make an application accessible from outside of your Kubernetes cluster. An Istio Gateway which was deployed using default profile is used for this purpose. Define the ingress gateway deploying gateway and virtual service specification. The gateway specification describes the L4-L6 properties of a load balancer and the virtual service specification describes the L7 properties of a load balancer. | ||
|
||
Example of the gateway and virtual service specification (You have to adapt the entire specification to the application): | ||
|
||
[Gateway](https://istio.io/latest/docs/reference/config/networking/gateway/): | ||
|
||
```yaml | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: Gateway | ||
metadata: | ||
name: httpbin-gateway | ||
spec: | ||
selector: | ||
istio: ingressgateway # use Istio default gateway implementation | ||
servers: | ||
- port: | ||
number: 80 | ||
name: http | ||
protocol: HTTP | ||
hosts: | ||
- "httpbin.example.com" | ||
``` | ||
[Virtual Service](https://istio.io/latest/docs/reference/config/networking/virtual-service/): | ||
```yaml | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: VirtualService | ||
metadata: | ||
name: httpbin | ||
spec: | ||
hosts: | ||
- "httpbin.example.com" | ||
gateways: | ||
- httpbin-gateway | ||
http: | ||
- match: | ||
- uri: | ||
prefix: /status | ||
- uri: | ||
prefix: /delay | ||
route: | ||
- destination: | ||
port: | ||
number: 8000 | ||
host: httpbin | ||
``` |