Typical Internet of Things (IoT) deployments are resource-constrained, with limited computation and storage, high network latency, and low bandwidth. The introduction of Edge and Cloud computing provides a method of mitigating these shortfalls. This paper proposes a framework for structuring IoT applications to allow for seamless offloading (based on CPU load) of work from IoT nodes to Edge and Cloud computing resources. The proposed flexible framework utilises software to orchestrate multiple containerised IoT applications for optimal performance within available computational resources. Edge and Cloud servers co-operate autonomously to determine the appropriate resource allocation based on the requirements of running IoT applications in real-time. The result is a framework that is suited to perform with heterogeneous IoT hardware while improving overall computational performance, latency and bandwidth relative to IoT architectures that do not auto-scale. This framework is evaluated using an experimental setup with multiple IoT nodes, Edge nodes and Cloud computing resources. It demonstrates the approach is viable and results in a flexible and scalable IoT solution.