尝试按以下方式部署kubernetes资源时出现错误:
suv@Suvankars-MacBook-Pro[8:50:09]:~/thermeon/gke-staging-envs/charts$ helm install --name=postfix postfix
NAME: postfix
LAST DEPLOYED: Sun Jul 12 20:50:15 2020
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/Service
NAME AGE
postfix 2s
==> v1beta2/Deployment
postfix 2s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
postfix-bdc88887f-4bp8q 0/1 ContainerCreating 0 2s
NOTES:
1. Get the application URL by running these commands:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w postfix'
export SERVICE_IP=$(kubectl get svc --namespace default postfix -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:25
suv@Suvankars-MacBook-Pro[8:50:39]:~/thermeon/gke-staging-envs/charts$ kubectl get svc -w postfix
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
postfix LoadBalancer 10.1.22.218 <pending> 25:31916/TCP 27s
^C% suv@Suvankars-MacBook-Pro[8:50:58]:~/thermeon/gke-staging-envs/charts$
suv@Suvankars-MacBook-Pro[8:50:59]:~/thermeon/gke-staging-envs/charts$
suv@Suvankars-MacBook-Pro[8:50:59]:~/thermeon/gke-staging-envs/charts$
suv@Suvankars-MacBook-Pro[8:51:03]:~/thermeon/gke-staging-envs/charts$ kubectl get pods
NAME READY STATUS RESTARTS AGE
postfix-bdc88887f-4bp8q 0/1 CrashLoopBackOff 2 50s
suv@Suvankars-MacBook-Pro[8:51:21]:~/thermeon/gke-staging-envs/charts$ kubectl get logs postfix-bdc88887f-4bp8q
error: the server doesn't have a resource type "logs"
答案 0 :(得分:2)
Kubectl's Official Documentation涵盖了kubectl语法,描述了命令操作,并提供了常见示例。
logs
kubectl logs POD [-c CONTAINER] [--follow] [flags]
打印容器中容器的日志。
您始终可以使用以下命令来检查kubectl
的命令(和语法示例):
$ kubectl --help
$ kubectl get --help
$ kubectl logs --help
以此类推。
在这种情况下,需要运行
kubectl logs postfix-bdc88887f-4bp8q
希望能对此进行解释,并深入了解从何处获取更多信息。
答案 1 :(得分:1)
日志不是Kubernetes中的资源,因此要获取Pod的日志,您不应在命令中指定get
,如下例所示。
kubectl logs postfix-bdc88887f-4bp8q