Clusters of galaxies provide valuable information on the evolution of the Universe and large scale structures. Recent cluster observations via the thermal Sunyaev-Zeldovich (tSZ) effect have proven to be a powerful tool to detect and study them. In this context, high resolution tSZ observations (~ tens of arcsec) are of particular interest to probe intermediate and high redshift clusters. Observations of the tSZ effect will be carried out with the millimeter dual-band NIKA2 camera, based on Kinetic Inductance Detectors (KIDs) to be installed at the IRAM 30-meter telescope in 2015. To demonstrate the potential of such an instrument, we present tSZ observations with the NIKA camera prototype, consisting of two arrays of 132 and 224 detectors that observe at 140 and 240 GHz with a 18.5 and 12.5 arcsec angular resolution, respectively. The cluster RX J1347.5-1145 was observed simultaneously at 140 and 240 GHz. We used a spectral decorrelation technique to remove the atmospheric noise and obtain a map of the cluster at 140 GHz. The efficiency of this procedure has been characterized through realistic simulations of the observations. The observed 140 GHz map presents a decrement at the cluster position consistent with the tSZ nature of the signal. We used this map to study the pressure distribution of the cluster by fitting a gNFW model to the data. Subtracting this model from the map, we confirm that RX J1347.5-1145 is an ongoing merger, which confirms and complements previous tSZ and X-ray observations. For the first time, we demonstrate the tSZ capability of KID based instruments. The NIKA2 camera with ~ 5000 detectors and a 6.5 arcmin field of view will be well-suited for in-depth studies of the intra cluster medium in intermediate to high redshifts, which enables the characterization of recently detected clusters by the Planck satellite.