From 54e7dcca25d7de4af6760a7b8a41400128b966b8 Mon Sep 17 00:00:00 2001 From: kevinten <596823919@qq.com> Date: Thu, 21 Jul 2022 19:07:57 +0800 Subject: [PATCH] docs: add demo deploy k8s standalone yaml. --- .../k8s/standalone/default_configmap.yaml | 145 ++++++++++++++ .../k8s/standalone/default_deployment.yaml | 34 ++++ .../k8s/standalone/default_quickstart.yaml | 182 ++++++++++++++++++ 3 files changed, 361 insertions(+) create mode 100644 demo/deploy/k8s/standalone/default_configmap.yaml create mode 100644 demo/deploy/k8s/standalone/default_deployment.yaml create mode 100644 demo/deploy/k8s/standalone/default_quickstart.yaml diff --git a/demo/deploy/k8s/standalone/default_configmap.yaml b/demo/deploy/k8s/standalone/default_configmap.yaml new file mode 100644 index 0000000000..20fb1587fc --- /dev/null +++ b/demo/deploy/k8s/standalone/default_configmap.yaml @@ -0,0 +1,145 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: layotto-runtime-config +data: + config.json: | + { + "servers": [ + { + "default_log_path": "stdout", + "default_log_level": "DEBUG", + "routers": [ + { + "router_config_name": "actuator_dont_need_router" + } + ], + "listeners": [ + { + "name": "grpc", + "address": "0.0.0.0:34904", + "bind_port": true, + "filter_chains": [ + { + "filters": [ + { + "type": "grpc", + "config": { + "server_name": "runtime", + "grpc_config": { + "hellos": { + "quick_start_demo": { + "type": "helloworld", + "hello": "greeting" + } + }, + "state": { + "state_demo": { + "type": "in-memory", + "metadata": { + } + } + }, + "lock": { + "lock_demo": { + "type": "in-memory", + "metadata": { + } + } + }, + "pub_subs": { + "pub_subs_demo": { + "type": "in-memory", + "metadata": { + "consumerID": "1" + } + } + }, + "sequencer": { + "sequencer_demo": { + "type": "in-memory", + "metadata": {} + } + }, + "secret_store": { + "secret_demo": { + "type": "local.env", + "metadata": { + } + } + }, + "bindings": { + "bindings_demo": { + "type": "http", + "metadata": { + "url": "https://mosn.io/layotto" + } + } + }, + "custom_component": { + "helloworld": { + "demo": { + "type": "in-memory", + "metadata": {} + } + } + }, + "app": { + "app_id": "app1", + "grpc_callback_port": 9999 + } + } + } + } + ] + } + ] + }, + { + "name": "actuator", + "address": "127.0.0.1:34999", + "bind_port": true, + "filter_chains": [ + { + "filters": [ + { + "type": "proxy", + "config": { + "downstream_protocol": "Http1", + "upstream_protocol": "Http1", + "router_config_name": "actuator_dont_need_router" + } + } + ] + } + ], + "stream_filters": [ + { + "type": "actuator_filter" + } + ] + } + ] + } + ], + "tracing": { + "enable": true, + "driver": "SOFATracer", + "config": { + "generator": "mosntracing", + "exporter": [ + "stdout" + ] + } + }, + "metrics": { + "sinks": [ + { + "type": "prometheus", + "config": { + "port": 34903 + } + } + ] + } + } \ No newline at end of file diff --git a/demo/deploy/k8s/standalone/default_deployment.yaml b/demo/deploy/k8s/standalone/default_deployment.yaml new file mode 100644 index 0000000000..526b5a2d27 --- /dev/null +++ b/demo/deploy/k8s/standalone/default_deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: layotto-runtime-deployment + labels: + app: layotto-runtime-deployment +spec: + selector: + matchLabels: + app: layotto-runtime + replicas: 1 + template: + metadata: + labels: + app: layotto-runtime + spec: + containers: + - name: layotto-runtime + image: layotto/layotto:latest + command: [ "/runtime/layotto", "start" ] + args: [ "-c", "/runtime/configs/config.json" ] + ports: + - containerPort: 34904 + volumeMounts: + - name: runtime-config + mountPath: /runtime/configs + readOnly: false + volumes: + - name: runtime-config + configMap: + name: layotto-runtime-config + items: + - key: config.json + path: config.json \ No newline at end of file diff --git a/demo/deploy/k8s/standalone/default_quickstart.yaml b/demo/deploy/k8s/standalone/default_quickstart.yaml new file mode 100644 index 0000000000..58cda42893 --- /dev/null +++ b/demo/deploy/k8s/standalone/default_quickstart.yaml @@ -0,0 +1,182 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: layotto-runtime-config +data: + config.json: | + { + "servers": [ + { + "default_log_path": "stdout", + "default_log_level": "DEBUG", + "routers": [ + { + "router_config_name": "actuator_dont_need_router" + } + ], + "listeners": [ + { + "name": "grpc", + "address": "0.0.0.0:34904", + "bind_port": true, + "filter_chains": [ + { + "filters": [ + { + "type": "grpc", + "config": { + "server_name": "runtime", + "grpc_config": { + "hellos": { + "quick_start_demo": { + "type": "helloworld", + "hello": "greeting" + } + }, + "state": { + "state_demo": { + "type": "in-memory", + "metadata": { + } + } + }, + "lock": { + "lock_demo": { + "type": "in-memory", + "metadata": { + } + } + }, + "pub_subs": { + "pub_subs_demo": { + "type": "in-memory", + "metadata": { + "consumerID": "1" + } + } + }, + "sequencer": { + "sequencer_demo": { + "type": "in-memory", + "metadata": {} + } + }, + "secret_store": { + "secret_demo": { + "type": "local.env", + "metadata": { + } + } + }, + "bindings": { + "bindings_demo": { + "type": "http", + "metadata": { + "url": "https://mosn.io/layotto" + } + } + }, + "custom_component": { + "helloworld": { + "demo": { + "type": "in-memory", + "metadata": {} + } + } + }, + "app": { + "app_id": "app1", + "grpc_callback_port": 9999 + } + } + } + } + ] + } + ] + }, + { + "name": "actuator", + "address": "127.0.0.1:34999", + "bind_port": true, + "filter_chains": [ + { + "filters": [ + { + "type": "proxy", + "config": { + "downstream_protocol": "Http1", + "upstream_protocol": "Http1", + "router_config_name": "actuator_dont_need_router" + } + } + ] + } + ], + "stream_filters": [ + { + "type": "actuator_filter" + } + ] + } + ] + } + ], + "tracing": { + "enable": true, + "driver": "SOFATracer", + "config": { + "generator": "mosntracing", + "exporter": [ + "stdout" + ] + } + }, + "metrics": { + "sinks": [ + { + "type": "prometheus", + "config": { + "port": 34903 + } + } + ] + } + } + +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: layotto-runtime-deployment + labels: + app: layotto-runtime-deployment +spec: + selector: + matchLabels: + app: layotto-runtime + replicas: 1 + template: + metadata: + labels: + app: layotto-runtime + spec: + containers: + - name: layotto-runtime + image: layotto/layotto:latest + command: [ "/runtime/layotto", "start" ] + args: [ "-c", "/runtime/configs/config.json" ] + ports: + - containerPort: 34904 + volumeMounts: + - name: runtime-config + mountPath: /runtime/configs + readOnly: false + volumes: + - name: runtime-config + configMap: + name: layotto-runtime-config + items: + - key: config.json + path: config.json \ No newline at end of file