On the k-metric dimension of metric spaces