diff --git a/README.md b/README.md index 348335e8..2e970381 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Kubernetes native stacks are built by extending Kubernetes Resource set (APIs) with Operators and their Custom Resources. Application workflows on Kubernetes are realized by establishing connections between Kubernetes Resources (APIs). These connections can be based on various relationships such as labels, annotations, ownership, etc.

- +

KubePlus tooling simplifies building, visualizing and monitoring these application workflows. KubePlus is being developed as part of our [Platform as Code practice](https://cloudark.io/platform-as-code). diff --git a/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer1.txt b/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer1.txt new file mode 100644 index 00000000..feb0e55d --- /dev/null +++ b/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer1.txt @@ -0,0 +1,32 @@ +(venv) Devs-MacBook:kubediscovery devdatta$ kubectl connections cr ClusterIssuer wordpress-stack namespace1 +Discovering connections - Level: 0, Kind:ClusterIssuer, instance:wordpress-stack +Discovering connections - Level: 1, Kind:Ingress, instance:wordpress-ingress +Discovering connections - Level: 2, Kind:Service, instance:wordpress +Discovering connections - Level: 3, Kind:Pod, instance:wordpress-pod +Discovering connections - Level: 4, Kind:Service, instance:cluster1-mysql-master +Discovering connections - Level: 5, Kind:Pod, instance:cluster1-mysql-0 +Discovering connections - Level: 6, Kind:Service, instance:cluster1-mysql-nodes +Discovering connections - Level: 7, Kind:MysqlCluster, instance:cluster1 +Discovering connections - Level: 8, Kind:StatefulSet, instance:cluster1-mysql +Discovering connections - Level: 8, Kind:Service, instance:cluster1-mysql +Discovering connections - Level: 8, Kind:Service, instance:cluster1-mysql-master +Discovering connections - Level: 8, Kind:Service, instance:cluster1-mysql-nodes +Discovering connections - Level: 8, Kind:ConfigMap, instance:cluster1-mysql + +::Final connections graph:: +------ Branch 1 ------ +Level:0 ClusterIssuer/wordpress-stack +Level:1 Ingress/wordpress-ingress [related to ClusterIssuer/wordpress-stack by:annotation] +Level:2 Service/wordpress [related to Ingress/wordpress-ingress by:specproperty] +Level:3 Pod/wordpress-pod [related to Service/wordpress by:label] +Level:4 Service/cluster1-mysql-master [related to Pod/wordpress-pod by:envvariable] +Level:5 Pod/cluster1-mysql-0 [related to Service/cluster1-mysql-master by:label] +Level:6 Service/cluster1-mysql [related to Pod/cluster1-mysql-0 by:label] +Level:6 Service/cluster1-mysql-nodes [related to Pod/cluster1-mysql-0 by:envvariable] +Level:6 Service/cluster1-mysql-nodes [related to Pod/cluster1-mysql-0 by:label] +Level:7 MysqlCluster/cluster1 [related to Service/cluster1-mysql-nodes by:owner reference] +Level:8 Service/cluster1-mysql [related to MysqlCluster/cluster1 by:owner reference] +Level:8 Service/cluster1-mysql-master [related to MysqlCluster/cluster1 by:owner reference] +Level:8 ConfigMap/cluster1-mysql [related to MysqlCluster/cluster1 by:owner reference] +Level:8 StatefulSet/cluster1-mysql [related to MysqlCluster/cluster1 by:owner reference] +Level:9 Pod/cluster1-mysql-0 [related to StatefulSet/cluster1-mysql by:owner reference] diff --git a/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer2.txt b/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer2.txt new file mode 100644 index 00000000..4d7e06ad --- /dev/null +++ b/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer2.txt @@ -0,0 +1,10 @@ +(venv) Devs-MacBook:kubediscovery devdatta$ kubectl connections cr ClusterIssuer wordpress-stack namespace1 +Discovering connections - Level: 0, Kind:ClusterIssuer, instance:wordpress-stack +Discovering connections - Level: 1, Kind:Ingress, instance:wordpress-ingress +Discovering connections - Level: 2, Kind:Service, instance:wordpress + +::Final connections graph:: +------ Branch 1 ------ +Level:0 ClusterIssuer/wordpress-stack +Level:1 Ingress/wordpress-ingress [related to ClusterIssuer/wordpress-stack by:annotation] +Level:2 Service/wordpress [related to Ingress/wordpress-ingress by:specproperty] diff --git a/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer3.txt b/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer3.txt new file mode 100644 index 00000000..10a7c031 --- /dev/null +++ b/examples/wordpress-mysqlcluster/kubectl-connections-clusterissuer3.txt @@ -0,0 +1,12 @@ +(venv) Devs-MacBook:kubediscovery devdatta$ kubectl connections cr ClusterIssuer wordpress-stack namespace1 +Discovering connections - Level: 0, Kind:ClusterIssuer, instance:wordpress-stack +Discovering connections - Level: 1, Kind:Ingress, instance:wordpress-ingress +Discovering connections - Level: 2, Kind:Service, instance:wordpress +Discovering connections - Level: 3, Kind:Pod, instance:wordpress-pod + +::Final connections graph:: +------ Branch 1 ------ +Level:0 ClusterIssuer/wordpress-stack +Level:1 Ingress/wordpress-ingress [related to ClusterIssuer/wordpress-stack by:annotation] +Level:2 Service/wordpress [related to Ingress/wordpress-ingress by:specproperty] +Level:3 Pod/wordpress-pod [related to Service/wordpress by:label] diff --git a/examples/wordpress-mysqlcluster/kubectl-connections-service1.txt b/examples/wordpress-mysqlcluster/kubectl-connections-service1.txt new file mode 100644 index 00000000..b5e7a05b --- /dev/null +++ b/examples/wordpress-mysqlcluster/kubectl-connections-service1.txt @@ -0,0 +1,14 @@ +(venv) Devs-MacBook:kubediscovery devdatta$ kubectl connections Service wordpress namespace1 +Discovering connections - Level: 0, Kind:Service, instance:wordpress +Discovering connections - Level: 1, Kind:Pod, instance:wordpress-pod +Discovering connections - Level: 1, Kind:Ingress, instance:wordpress-ingress +Discovering connections - Level: 2, Kind:ClusterIssuer, instance:wordpress-stack + +::Final connections graph:: +------ Branch 1 ------ +Level:0 Service/wordpress +Level:1 Pod/wordpress-pod [related to Service/wordpress by:label] +------ Branch 2 ------ +Level:0 Service/wordpress +Level:1 Ingress/wordpress-ingress [related to Service/wordpress by:specproperty] +Level:2 ClusterIssuer/wordpress-stack [related to Ingress/wordpress-ingress by:annotation] diff --git a/examples/wordpress-mysqlcluster/steps.txt b/examples/wordpress-mysqlcluster/steps.txt index b7148e9a..0792beb9 100644 --- a/examples/wordpress-mysqlcluster/steps.txt +++ b/examples/wordpress-mysqlcluster/steps.txt @@ -52,6 +52,9 @@ Steps: - Base64 decode the value of cluster1-secret and add that value to WORDPRESS_DB_PASSWORD environment variable - kubectl create -f wordpress-pod.yaml + - kubectl create -f wordpress-service.yaml + - kubectl create -f wordpress-ingress.yaml + - kubectl create -f clusterissuer.yaml 10) Check the connections - kubectl connections cr MysqlCluster cluster1 namespace1 diff --git a/examples/wordpress-mysqlcluster/wordpress-ingress.yaml b/examples/wordpress-mysqlcluster/wordpress-ingress.yaml index 39314835..76663432 100644 --- a/examples/wordpress-mysqlcluster/wordpress-ingress.yaml +++ b/examples/wordpress-mysqlcluster/wordpress-ingress.yaml @@ -5,6 +5,7 @@ metadata: # add an annotation indicating the issuer to use. cert-manager.io/cluster-issuer: wordpress-stack name: wordpress-ingress + namespace: namespace1 spec: rules: - host: myingress.com diff --git a/examples/wordpress-mysqlcluster/wordpress-pod.yaml b/examples/wordpress-mysqlcluster/wordpress-pod.yaml index bec60013..01dc60e8 100644 --- a/examples/wordpress-mysqlcluster/wordpress-pod.yaml +++ b/examples/wordpress-mysqlcluster/wordpress-pod.yaml @@ -1,19 +1,4 @@ apiVersion: v1 -kind: Service -metadata: - name: wordpress - namespace: namespace1 - labels: - app: wordpress -spec: - ports: - - port: 80 - selector: - app: wordpress - tier: frontend - type: ClusterIP ---- -apiVersion: v1 kind: PersistentVolumeClaim metadata: name: wp-pv-claim @@ -54,25 +39,4 @@ spec: - name: wordpress-persistent-storage persistentVolumeClaim: claimName: wp-pv-claim ---- -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - annotations: - # add an annotation indicating the issuer to use. - cert-manager.io/cluster-issuer: wordpress-stack - name: wordpress-ingress - namespace: namespace1 -spec: - rules: - - host: myingress.com - http: - paths: - - backend: - serviceName: wordpress - servicePort: 80 - path: / - tls: # < placing a host in the TLS config will indicate a certificate should be created - - hosts: - - myingress.com - secretName: myingress-cert # < cert-manager will store the created certificate in this secret. + diff --git a/examples/wordpress-mysqlcluster/wordpress-service.yaml b/examples/wordpress-mysqlcluster/wordpress-service.yaml new file mode 100644 index 00000000..91d03dac --- /dev/null +++ b/examples/wordpress-mysqlcluster/wordpress-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: wordpress + namespace: namespace1 + labels: + app: wordpress +spec: + ports: + - port: 80 + selector: + app: wordpress + tier: frontend + type: ClusterIP +