diff --git a/server/sandbox_run.go b/server/sandbox_run.go index 815175e2..a3de2313 100644 --- a/server/sandbox_run.go +++ b/server/sandbox_run.go @@ -472,7 +472,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest } if len(portMappings) != 0 { - ip, err := s.netPlugin.GetContainerNetworkStatus(netNsPath, namespace, id, containerName) + ip, err := s.netPlugin.GetContainerNetworkStatus(netNsPath, namespace, id, kubeName) if err != nil { return nil, fmt.Errorf("failed to get network status for container %s in sandbox %s: %v", containerName, id, err) } @@ -483,7 +483,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest } if err = s.hostportManager.Add(id, &hostport.PodPortMapping{ - Name: name, + Name: kubeName, PortMappings: portMappings, IP: ip4, HostNetwork: false, diff --git a/server/sandbox_stop.go b/server/sandbox_stop.go index bdd85a24..aeef9dd1 100644 --- a/server/sandbox_stop.go +++ b/server/sandbox_stop.go @@ -51,7 +51,7 @@ func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxReque } if _, err := os.Stat(netnsPath); err == nil { if err2 := s.hostportManager.Remove(sb.ID(), &hostport.PodPortMapping{ - Name: sb.Name(), + Name: sb.KubeName(), PortMappings: sb.PortMappings(), HostNetwork: false, }); err2 != nil {