smartfog / fogflow

FogFlow is a standard-based IoT fog computing framework that supports serverless computing and edge computing with advanced programming models
https://fogflow.readthedocs.io
BSD 3-Clause "New" or "Revised" License
123 stars 45 forks source link

cleanup the yaml file for worker in the k8s deployment #321

Closed smartfog closed 2 years ago

smartfog commented 2 years ago

In the yaml/cloud-yaml/worker.yaml and yaml/edge-yaml/edge-worker.yaml, the docker.sock part is not needed any more. They should be cleaned up.

showersky commented 2 years ago

It seems that the usage of docker APIs is not complete cleaned up in the following file.

https://github.com/smartfog/fogflow/blob/development/k8sWorker/executor.go

This is why the k8s deployment script still includes the dockersock. We need to clean up the executor.go and replace all the usage of docker API with k8s API.

BabutaAniket commented 2 years ago

@showersky I have an doubt. Docker daemon is listening to docker.sock and it entry point for Docker API. In yaml/cloud-yaml/worker.yaml we mount Docker socket which enables us to launch new containers from within worker. So if I remove docker.sock from yaml files, my containers won’t launch while running any of the use-case:

root@ss:~/helm_fogflow# docker logs -f  fe920f3524f8
INFO: 2022/01/21 10:44:15 communicating with the broker  http://172.30.48.24:8070/ngsi10
INFO: 2022/01/21 10:44:15 annouce myself to the nearby broker
2022/01/21 10:44:15 [*] Waiting for messages. To exit press CTRL+C
INFO: 2022/01/21 10:47:08 I am going to fetch the docker image fogflow/nodejs
DEBUG: 2022/01/21 10:47:08 executor.go:117: options : {Username: Password: Email: ServerAddress: IdentityToken: RegistryToken:}
DEBUG: 2022/01/21 10:47:08 executor.go:124: options : {Repository:fogflow/nodejs Tag:latest Platform: Registry: OutputStream:<nil> RawJSONStream:false InactivityTimeout:0s Context:<nil>}
ERROR: 2022/01/21 10:47:08 executor.go:128: failed to pull this image fogflow/nodejs, error dial unix /var/run/docker.sock: connect: no such file or directory
INFO: 2022/01/21 10:50:35 execute task  Task.Crop_Prediction.Crop.1242463947  with operation fogflow/soil:latest
INFO: 2022/01/21 10:50:35 task configuration {ID:Task.Crop_Prediction.Crop.1242463947 ServiceName:Crop_Prediction TaskName:Crop OperatorName:Crop_Predict TaskType: FunctionCode: DockerImage:fogflow/soil:latest Parameters:[] WorkerID:Worker.001 IsExclusive:false PriorityLevel:50 Status:scheduled Inputs:[{Type:SoilSensor ID:urn:ngsi-ld:Device.SoilSensor54@default FiwareServicePath: MsgFormat:NGSILD AttributeList:[]}] Outputs:[{Type:CropPrediction StreamID:CropPrediction.1242463947.1 Annotations:[]}]}
INFO: 2022/01/21 10:50:35 task runnable =  true
&{Task.Crop_Prediction.Crop.1242463947 Crop_Prediction Crop Crop_Predict   fogflow/soil:latest [] Worker.001 false 50 running [{SoilSensor urn:ngsi-ld:Device.SoilSensor54@default  NGSILD []}] [{CropPrediction CropPrediction.1242463947.1 []}]}
INFO: 2022/01/21 10:50:35 to execute Task  Task.Crop_Prediction.Crop.1242463947  to perform Operation  fogflow/soil:latest
INFO: 2022/01/21 10:50:35 operator image fogflow/soil:latest does not exist locally
DEBUG: 2022/01/21 10:50:35 executor.go:117: options : {Username: Password: Email: ServerAddress: IdentityToken: RegistryToken:}
DEBUG: 2022/01/21 10:50:35 executor.go:124: options : {Repository:fogflow/soil:latest Tag:latest Platform: Registry: OutputStream:<nil> RawJSONStream:false InactivityTimeout:0s Context:<nil>}
**ERROR: 2022/01/21 10:50:35 executor.go:128: failed to pull this image fogflow/soil:latest, error dial unix /var/run/docker.sock: connect: no such file or directory**
ERROR: 2022/01/21 10:50:35 executor.go:311: failed to fetch the image fogflow/soil:latest

I have tried changing the endpoint to other CRI in k8s but the issue is still present. In /k8sworker/pod.go file, the image for the in pod is passed from executor.go and in executor.go the endpoint for unix is set default to unix:///var/run/docker.sock. Even if I replace docker API with k8s API in executor.go, it is difficult to launch a container inside another container without docker.sock (same error as above).

showersky commented 2 years ago

this has been addressed in the latest deployment script for k8s