forked from CiscoCloud/vaquero-vagrant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kubernetes deployment of Vaquero (CiscoCloud#37)
- Loading branch information
1 parent
b1d3bda
commit d91ba48
Showing
10 changed files
with
278 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#Kubernetes in the VirtualEnv | ||
|
||
It is highly recommended to stand up VS boxes with V_DEV=1, to get more memory and compute allocated to the VM. Performance will drag if not used. | ||
|
||
|
||
*Note: This is for sake fo example and testing, should only be used for testing, we do not set up external routable IPs for the vs-service. Since no external IP is set up for the vaquero-server(s), the vaquero-agent MUST be deployed in the kubernetes cluster, and use the service `clusterIP` to reach the vaquero-server(s)* | ||
|
||
|
||
`V_DEV=1 vagrant up` : VS-1 will be the K8s master, VS-1 and all subsequent VS-<num> machines will be K8s minions. | ||
|
||
##For all VS machines you stand up (starting kubernetes services) | ||
1. `vagrant ssh vs-<num>` | ||
2. `sudo ./kube-start.sh` | ||
|
||
##On any of the VS machines | ||
3. `/vagrant/kube/vs.sh` - sets up a configmap, secret, reploys the `vs-rc` and `vs-svc` | ||
4. `kubectl get svc` - Pull the "clusterIP" off of the `vs-svc` | ||
5. Paste the "clusterIP" from step 4 into the agent config that lives at `/vagrant/kube/va-config.yaml` | ||
6. `/vagrant/kube/va.sh` - creates a configmap and runs the `va-pod` | ||
|
||
##On your physical host | ||
7. `./create_cluster/cluster.sh -d core-cloud` - Booting machines like you would normally. | ||
|
||
|
||
If configuration changes are required, you must `kubectl delete configmap <configmap-name>` and then `kubectl create configmap <configmap-name> --from-file=<path-to-file>`. See the `va.sh` and `vs.sh` for reference. Renaming the configs will cause the key names to change, and force you to update the `*Pod.yaml` files. | ||
|
||
|
||
If you wish to use your own container, replace the `image` in the RC or Pod files. Below it add `imagePullPolocy: IfNotPresent` to ensure kubernetes will look at your local docker images before checking the web. *To use local containers the version CANNOT be `latest`, if you use latest it will always pull from the internet* |
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 @@ | ||
ServerClient: | ||
Addr: "<INSERT vs-service CLUSTERIP here>" | ||
Port: 24601 | ||
InsecureSkipVerify: true | ||
SavePath: "/var/vaquero" | ||
Log: | ||
Level: info | ||
Location: stdout | ||
LogType: text |
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,4 @@ | ||
#!/bin/bash | ||
|
||
kubectl create configmap va-config --from-file=/vagrant/kube/va-config.yaml | ||
kubectl create -f /vagrant/kube/vaPod.yaml |
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,41 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: va-pod | ||
labels: | ||
app: va-pod | ||
spec: | ||
hostNetwork: true | ||
containers: | ||
- name: va-pod | ||
image: shippedrepos-docker-vaquero.bintray.io/vaquero/vaquero:latest | ||
args: | ||
- "agent" | ||
- "--config" | ||
- "/config/config.yaml" | ||
env: | ||
- name: VAQUERO_SHARED_SECRET | ||
value: "shared" | ||
- name: VAQUERO_SERVER_SECRET | ||
value: "server" | ||
- name: VAQUERO_SITE_ID | ||
value: "test-site" | ||
- name: VAQUERO_AGENT_ID | ||
value: "test-agent" | ||
ports: | ||
- containerPort: 24602 | ||
volumeMounts: | ||
- mountPath: /config | ||
name: config | ||
- mountPath: /var/vaquero/files | ||
name: assets | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: va-config | ||
items: | ||
- key: va-config.yaml | ||
path: config.yaml | ||
- name: assets | ||
hostPath: | ||
path: /var/vaquero/files |
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,32 @@ | ||
UserApi: | ||
Addr: "0.0.0.0" | ||
Port: 24604 | ||
ServerAPI: | ||
Addr: "0.0.0.0" | ||
Port: 24601 | ||
PrivateKey: "/secret/server.key" | ||
PublicKey: "/secret/server.pem" | ||
SavePath: "/var/vaquero" | ||
Gitter: | ||
Endpoint: "/postreceive" | ||
Timeout: 2 | ||
Addr: "0.0.0.0" | ||
Port: 24603 | ||
Etcd: | ||
Endpoints: | ||
- "http://10.10.10.5:2379" | ||
- "http://10.10.10.6:2379" | ||
- "http://10.10.10.7:2379" | ||
Timeout: 5 | ||
Retry: 3 | ||
HA: true | ||
LocalDir: | ||
PollInterval: 2 | ||
SoT: | ||
- Local: | ||
ID: "vaquero-local" | ||
Root: /dm | ||
Log: | ||
Level: info | ||
Location: stdout | ||
LogType: text |
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,6 @@ | ||
#!/bin/bash | ||
|
||
kubectl create secret generic ssh-key --from-file=/vagrant/provision_files/secret/server.pem --from-file=/vagrant/provision_files/secret/server.key | ||
kubectl create configmap vs-config --from-file=/vagrant/kube/vs-config.yaml | ||
kubectl create -f /vagrant/kube/vsRc.yaml | ||
kubectl create -f /vagrant/kube/vsSvc.yaml |
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,63 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: vs-dep | ||
spec: | ||
replicas: 3 | ||
template: | ||
metadata: | ||
name: vs-pod | ||
labels: | ||
app: vs-pod | ||
spec: | ||
containers: | ||
- name: vs-pod | ||
image: shippedrepos-docker-vaquero.bintray.io/vaquero/vaquero | ||
args: | ||
- "server" | ||
- "--config" | ||
- "/config/config.yaml" | ||
env: | ||
- name: VAQUERO_SHARED_SECRET | ||
value: "shared" | ||
- name: VAQUERO_SERVER_SECRET | ||
value: "server" | ||
- name: VAQUERO_SITE_ID | ||
value: "test-site" | ||
- name: VAQUERO_AGENT_ID | ||
value: "test-agent" | ||
ports: | ||
- containerPort: 24601 | ||
- containerPort: 24603 | ||
- containerPort: 24604 | ||
readinessProbe: | ||
httpGet: | ||
path: /ready | ||
port: 24604 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 1 | ||
volumeMounts: | ||
- mountPath: /config | ||
name: config | ||
- mountPath: /secret | ||
name: ssh | ||
- mountPath: /dm | ||
name: dm | ||
volumes: | ||
- name: dm | ||
hostPath: | ||
path: /vagrant/local | ||
- name: config | ||
configMap: | ||
name: vs-config | ||
items: | ||
- key: vs-config.yaml | ||
path: config.yaml | ||
- name: ssh | ||
secret: | ||
secretName: ssh-key | ||
items: | ||
- key: server.pem | ||
path: server.pem | ||
- key: server.key | ||
path: server.key |
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,65 @@ | ||
apiVersion: v1 | ||
kind: ReplicationController | ||
metadata: | ||
name: vs-rc | ||
spec: | ||
replicas: 3 | ||
selector: | ||
app: vs-pod | ||
template: | ||
metadata: | ||
name: vs-pod | ||
labels: | ||
app: vs-pod | ||
spec: | ||
containers: | ||
- name: vs-pod | ||
image: shippedrepos-docker-vaquero.bintray.io/vaquero/vaquero:latest | ||
args: | ||
- "server" | ||
- "--config" | ||
- "/config/config.yaml" | ||
env: | ||
- name: VAQUERO_SHARED_SECRET | ||
value: "shared" | ||
- name: VAQUERO_SERVER_SECRET | ||
value: "server" | ||
- name: VAQUERO_SITE_ID | ||
value: "test-site" | ||
- name: VAQUERO_AGENT_ID | ||
value: "test-agent" | ||
ports: | ||
- containerPort: 24601 | ||
- containerPort: 24603 | ||
- containerPort: 24604 | ||
readinessProbe: | ||
httpGet: | ||
path: /ready | ||
port: 24604 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 1 | ||
volumeMounts: | ||
- mountPath: /config | ||
name: config | ||
- mountPath: /secret | ||
name: ssh | ||
- mountPath: /dm | ||
name: dm | ||
volumes: | ||
- name: dm | ||
hostPath: | ||
path: /vagrant/local | ||
- name: config | ||
configMap: | ||
name: vs-config | ||
items: | ||
- key: vs-config.yaml | ||
path: config.yaml | ||
- name: ssh | ||
secret: | ||
secretName: ssh-key | ||
items: | ||
- key: server.pem | ||
path: server.pem | ||
- key: server.key | ||
path: server.key |
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,22 @@ | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: vs-svc | ||
spec: | ||
type: NodePort | ||
selector: | ||
app: vs-pod | ||
ports: | ||
- name: v1 | ||
protocol: TCP | ||
port: 24601 | ||
nodePort: 30601 | ||
- name: v3 | ||
protocol: TCP | ||
port: 24603 | ||
nodePort: 30603 | ||
- name: v4 | ||
protocol: TCP | ||
port: 24604 | ||
nodePort: 30604 |
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