code: func (s *Server) getAttach(request *restful.Request, response *restful.Response) {
  	params := getExecRequestParams(request)
  	streamOpts, err := remotecommandserver.NewOptions(request.Request)
  	if err != nil {
  		utilruntime.HandleError(err)
  		response.WriteError(http.StatusBadRequest, err)
  		return
  	}
  	pod, ok := s.host.GetPodByName(params.podNamespace, params.podName)
  	if !ok {
  		response.WriteError(http.StatusNotFound, fmt.Errorf("pod does not exist"))
  		return
  	}
  
  	podFullName := kubecontainer.GetPodFullName(pod)
  	url, err := s.host.GetAttach(podFullName, params.podUID, params.containerName, *streamOpts)
  	if err != nil {
  		streaming.WriteError(err, response.ResponseWriter)
  		return
  	}
  
  	if s.redirectContainerStreaming {
  		http.Redirect(response.ResponseWriter, request.Request, url.String(), http.StatusFound)
  		return
  	}
  	proxyStream(response.ResponseWriter, request.Request, url)
  }
docs: // getAttach handles requests to attach to a container.