Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tools/merak-aca-container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:18.04
RUN apt update
RUN apt upgrade -y
RUN apt install -y git
RUN apt install -y wget
RUN apt install -y uuid
RUN apt-get install -y uuid-dev
RUN apt install -y openvswitch-switch=2.9.8-0ubuntu0.18.04.2

RUN git clone --recurse-submodules https://github.com/futurewei-cloud/alcor-control-agent.git /root/alcor-control-agent

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
RUN /root/alcor-control-agent/build/aca-machine-init.sh
CMD sh /root/alcor-control-agent/build/aca_container/aca_run.sh
48 changes: 48 additions & 0 deletions tools/merak-aca-container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# How to build ACA image and run it in docker/k8s

Use the bellow command to build image
```
docker build --no-cache -f Dockerfile -t aca_build .
```

After Build we can rename(tag) it, no need to do, unless upload to dockerhub:
```
docker tag <IMAGE ID> <username>/<aca_image_name>
```
To upload image to Dockerhub:
```
docker push <username>/<aca_image_name>
```

To download image to physical machines:
```
docker pull <username>/<aca_image_name>
```

To run the docer image in container:
```
docker container run -d -it --cap-add=NET_ADMIN --cap-add=SYS_PTRACE --privileged --security-opt seccomp=unconfined --name <aca_container_name> <username>/<aca_image_name> /bin/bash
```

To Login to the Docker container:
```
docker exec -u 0 -it <aca_container_name> /bin/bash
```

___

## For k8s
To run the above aca image in K8s, we need to run the folling command on all k8s nodes.
```
docker pull <username>/<aca_image_name>
```

Then we can use the bellow yaml file to create ACA pods in k8s:
```
Kubectl create -f aca_k8s.yaml
```

To get into ACA pod:
```
kubectl exec --stdin --tty <aca_pod_name> -- /bin/bash
```
24 changes: 24 additions & 0 deletions tools/merak-aca-container/aca_k8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: aca-deployment
spec:
selector:
matchLabels:
app: aca
replicas: 1 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: aca
spec:
# hostPID: true
containers:
- name: aca
image: aca_image
command: ["/bin/sh","-c"]
args: ["service rsyslog restart && /etc/init.d/openvswitch-switch restart && /root/alcor-control-agent/build/bin/AlcorControlAgent -d -a 10.213.43.251 -p 30014"]
securityContext:
privileged: true
ports:
- containerPort: 50001