@@ -6,7 +6,7 @@ A simple static analysis tool to explore and diagnosticate network policies decl
6
6
7
7
![ demo] ( docs/assets/demo.gif )
8
8
9
- ## How to use
9
+ ## Main features
10
10
11
11
The left part of the screen contains the controls for the main view:
12
12
- Filters: filter pods by namespace, labels and name
@@ -30,10 +30,18 @@ Hover over a route to investigate allowed traffic:
30
30
- Ports
31
31
- Explanation (lack of isolation or network policies allowing traffic)
32
32
33
+ ## Installation
33
34
34
- ## Run inside your cluster
35
+ There are two ways to install and run Karto:
36
+ - To deploy it inside the Kubernetes cluster to analyze, proceed to the
37
+ [ Run inside a cluster] ( #run-inside-a-cluster ) section.
38
+ - To run it on any machine outside the Kubernetes cluster to analyze, refer to the
39
+ [ Run outside a cluster] ( #run-outside-a-cluster ) section.
40
+
41
+ ### Run inside a cluster
42
+
43
+ #### Deployment
35
44
36
- ### Deployment
37
45
Simply apply the provided descriptor:
38
46
``` shell script
39
47
kubectl apply -f deploy/k8s.yml
@@ -44,7 +52,8 @@ This will:
44
52
policies in the cluster
45
53
- deploy an instance of the application in this namespace with this service account
46
54
47
- ### Exposition
55
+ #### Exposition
56
+
48
57
Once deployed, the application must be exposed. For a quick try, use ` port-forward ` :
49
58
``` shell script
50
59
kubectl -n karto port-forward < pod name> 8000:8000
@@ -55,49 +64,72 @@ For a long-term solution, investigate the use of a [LoadBalancer service](
55
64
https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types ) or an [ Ingress] (
56
65
https://kubernetes.io/docs/concepts/services-networking/ingress/ ).
57
66
58
- Remember to always secure the access to the application as it obviously displays sensitive data about your cluster.
67
+ * Remember to always secure the access to the application as it obviously displays sensitive data about your cluster.*
68
+
69
+ #### Cleanup
59
70
60
- ### Cleanup
61
71
Delete everything using the same descriptor:
62
72
``` shell script
63
73
kubectl delete -f deploy/k8s.yml
64
74
```
65
75
76
+ ### Run outside a cluster
77
+
78
+ For this to work, a local ` kubeconfig ` file with existing connection information to the target cluster must be present
79
+ on the machine (if you already use ` kubectl ` locally, you are good to go!).
80
+
81
+ Simply download the Karto binary from the [ releases page] ( https://github.com/Zenika/karto/releases ) and run it!
66
82
67
- ## Run locally
83
+ ## Development
68
84
69
85
### Prerequisites
86
+
70
87
The following tools must be available locally:
71
- - [ Go] ( https://golang.org/doc/install )
72
- - [ NodeJS] ( https://nodejs.org/en/download/ )
88
+ - [ Go] ( https://golang.org/doc/install ) (tested with Go 1.14)
89
+ - [ NodeJS 10+] ( https://nodejs.org/en/download/ ) (tested with NodeJS 10)
90
+
91
+ ### Run the frontend in dev mode:
73
92
74
- ### Frontend
75
- To run in development mode:
93
+ In the ` front ` folder, execute:
76
94
``` shell script
77
95
npm start
78
96
```
79
97
This will expose the app in dev mode on ` localhost:3000 ` with a proxy to ` localhost:8000 ` for the API calls.
80
98
81
- To compile:
99
+ ### Run the backend locally:
100
+
101
+ Simply execute:
82
102
``` shell script
83
- npm run build
103
+ go build karto
104
+ ./karto
84
105
```
85
- This will generate a ` build ` folder in ` /front ` that can be served statically.
86
106
87
- ### Backend
88
- To build the main executable:
107
+ ### Test suites
108
+
109
+ To run the entire backend test suite:
89
110
``` shell script
90
- go build karto
111
+ go test ./...
91
112
```
92
- This executable runs on port 8080 and serves the content of ` ./front/build ` on the ` / ` route and the API on the ` /api `
93
- route. If you choose not to run the frontend in development mode, remember to always refresh the frontend content (if
94
- modified) using the npm ` build ` command described above.
95
113
114
+ ### Compile the go binary from source
96
115
97
- ## Test suites
116
+ In production mode, the frontend is packaged in the go binary using [ pkger] ( https://github.com/markbates/pkger ) . In this
117
+ configuration, the frontend is served on the ` / ` route and the API on the ` /api ` route.
98
118
99
- ### Backend
100
- To run the entire test suite:
119
+ To compile the Karto binary from source, first compile the frontend source code. In the ` front ` folder, execute:
101
120
``` shell script
102
- go test ./...
121
+ npm run build
122
+ ```
123
+ This will generate a ` build ` folder in ` /front ` .
124
+
125
+ Then, package it inside the backend:
126
+ ``` shell script
127
+ go install github.com/markbates/pkger/cmd/pkger
128
+ pkger
129
+ ```
130
+ This will generate a ` pkged.go ` file at the root with a binary content equivalent to the generated ` build ` folder.
131
+
132
+ Finally, compile the go binary:
133
+ ``` shell script
134
+ go build karto
103
135
```
0 commit comments