Question: I've the following graph,

```
ed_ls = [(0, 1), (0, 63), (1, 2), (1, 3), (54, 0)]
ed_w = [1, 2, 3, 4, 5]
G = nx.Graph()
G.add_edges_from(ed_ls)
edge_w = OrderedDict(zip(G.edges, ed_w))
nx.set_edge_attributes(G, edge_w, 'weight')

print(G.edges)
print(nx.get_edge_attributes(G, 'weight'))

```

Output obtained:

```
{(0, 1): 1, (0, 63): 2, (0, 54): 3, (1, 2): 4, (1, 3): 5}

```

The edge weights in `ed_w` are in the same order of edges in `ed_ls`. Since the order of edges
is not preserved, wrong edge weights are assigned. I could use `nx.DiGraph` to avoid this problem. However, I want to use `nx.k_core` later on and this doesn't work on directed graphs. Suggestions on
how to go ahead will be highly appreciated.

Answer: 
Pods (even in the same namespace) are not able to talk **directly** to each other by default. You need to create a `Service` in order to allow a pod to receive connections from another pod. In general, one pod connects to another pod via the latter's service, as I illustrated below:

[![enter image description here](https://i.stack.imgur.com/mV4ax.png)](https://i.stack.imgur.com/mV4ax.png)

The connection info would look something like `<servicename>:<serviceport>` (e.g. `elasticsearch-master:9200`) rather than `localhost:port`.

You can read <https://kubernetes.io/docs/concepts/services-networking/service/> for further info on a service.

N.B: `localhost:port` will only work for containers running inside the same pod to connect to each other, just like how nginx connects to gravitee-mgmt-api and gravitee-mgmt-ui in my illustration above.
For communication between pods `localhost` or `127.0.0.1` does not work.

Get the IP of any pod using

```
kubectl describe podname

```

Use that IP in the other pod to communicate with above pod.

Since Pod IPs changes if the pod is recreated you should ideally use [kubernetes service](https://kubernetes.io/docs/concepts/services-networking/service/) specifically `clusterIP` type for communication between pods within the cluster.