在minikube hyper-v机器上,我使用sawtooth config file部署了锯齿波0。
现在,当我检查运行的pod时,它似乎有一些默认的pod,但在尝试与kubernetes shell容器连接时。
C:\Users\Debo>kubectl get --all-namespaces
You must specify the type of resource to get. Use "kubectl api-resources" for a complete list of supported resources.
error: Required resource not specified.
Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
See 'kubectl get -h' for help and examples
C:\Users\Debo>kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default sawtooth-0-65d547498c-mfrsb 7/7 Running 1 120m
kube-system coredns-6955765f44-b684l 1/1 Running 0 122m
kube-system coredns-6955765f44-tc4vg 1/1 Running 0 122m
kube-system etcd-minikube 1/1 Running 0 121m
kube-system kube-addon-manager-minikube 1/1 Running 0 121m
kube-system kube-apiserver-minikube 1/1 Running 0 121m
kube-system kube-controller-manager-minikube 1/1 Running 0 121m
kube-system kube-proxy-t7nhs 1/1 Running 0 122m
kube-system kube-scheduler-minikube 1/1 Running 0 121m
kube-system storage-provisioner 1/1 Running 0 122m
kubernetes-dashboard dashboard-metrics-scraper-7b64584c5c-b8t7s 1/1 Running 0 122m
kubernetes-dashboard kubernetes-dashboard-79d9cd965-pn94z 1/1 Running 0 122m
C:\Users\Debo>kubectl get pods
NAME READY STATUS RESTARTS AGE
sawtooth-0-65d547498c-mfrsb 7/7 Running 1 120m
C:\Users\Debo>kubectl exec -it $(kubectl get pods | awk "/sawtooth-0/ {print $1}") --container sawtooth-shell -- bash
awk: /sawtooth-0/ {print $1})
awk: ^ syntax error
errcount: 1
Error from server (NotFound): pods "$(kubectl" not found
C:\Users\Debo>
1条答案
按热度按时间ajsxfq5m1#
如果我理解您的用例,您正尝试从名称空间中的给予pod列表中过滤锯齿-0 pod,然后打开一个交互式会话,指向在其中运行的容器,您知道容器名称。
因此,为了解决上述问题,我将锯齿配置文件附加在问题中,并启动了锯齿0和锯齿1的两个示例以及一些虚拟pod,然后我在windows power shell上使用此命令过滤并连接到锯齿0 pod上的容器。
以下所有操作均假定您需要在windows powershell上运行kubectl
连接到锯齿波-0
连接到锯齿波-1