You can deploy API Scout to Kubernetes by following three easy steps
Assuming you want to run API Scout inside your Kubernetes cluster, which is the recommended option, you’ll need to create an RBAC role so that the ServiceAccount has view access to the Kubernetes API server. This is the least privileged option for API Scout.
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: default-view
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: default
namespace: default
The second step is to create a deployment, instructing Kubernetes to deploy API Scout. Using the template yaml file below, there are a few parameters you can update:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
run: apiscout
name: apiscout
namespace: default
spec:
replicas: 1
selector:
matchLabels:
run: apiscout
template:
metadata:
labels:
run: apiscout
spec:
containers:
- name: apiscout
image: <your image>
env:
- name: MODE
value: "KUBE"
- name: HUGODIR
value: "/tmp"
- name: EXTERNALIP
value: "192.168.99.100"
imagePullPolicy: Never
ports:
- containerPort: 80
To allow access to the documentation portal, the final step is to create a service. The below template will instruct Kubernetes to make API Scout available to the outside world on port 8181.
apiVersion: v1
kind: Service
metadata:
labels:
run: apiscout-svc
name: apiscout-svc
namespace: default
spec:
ports:
- port: 8181
protocol: TCP
targetPort: 80
selector:
run: apiscout
type: LoadBalancer
With YAML you can combine the above steps into a single document. If you prefer that, the complete document will look like:
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: default-view
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: default
namespace: default
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
run: apiscout
name: apiscout
namespace: default
spec:
replicas: 1
selector:
matchLabels:
run: apiscout
template:
metadata:
labels:
run: apiscout
spec:
containers:
- name: apiscout
image: retgits/apiscout:latest
env:
- name: MODE
value: "KUBE"
- name: HUGODIR
value: "/tmp"
- name: EXTERNALIP
value: "192.168.99.100"
imagePullPolicy: Never
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
labels:
run: apiscout-svc
name: apiscout-svc
namespace: default
spec:
ports:
- port: 8181
protocol: TCP
targetPort: 80
selector:
run: apiscout
type: LoadBalancer