如何从kubectl访问节点

时间:2018-03-25 11:52:39

标签: kubernetes kubectl google-kubernetes-engine

在此doc中,他们使用u@node$来定义命令是从群集中的节点完成的。但是如何从kubectl进入节点?

详细介绍了如何转到广告u@pod$

2 个答案:

答案 0 :(得分:4)

apiserver可以用作HTTP代理(如here所述)来命中节点上的端点,但我认为你需要一个无法帮助的SSH会话。

在GKE上,您可以使用gcloud通过SSH连接到您的节点,如下所示:

  • gcloud compute instances list
  • gcloud compute ssh <nodeName>

答案 1 :(得分:2)

在GKE上,您只需选择您的群集并单击SSH按钮。如果从命令行,那么:

    Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/travis/build/Bonifase/WeConnect-/api/test_business.py", line 2, in <module>
    import app
  File "/home/travis/build/Bonifase/WeConnect-/api/app.py", line 3, in <module>
    from flask_sqlalchemy import SQLAlchemy
ModuleNotFoundError: No module named 'flask_sqlalchemy'