-2

我已按照链接中描述的步骤进行操作。

当我在helm install(第 2 步)的部分并尝试运行时:

helm install --name web ./demo

我收到以下错误:

获取https://10.96.0.1:443/version?timeout=32s : 拨打 tcp 10.96.0.1:443: i/o timeout

预期结果:它应该安装和部署图表。

4

1 回答 1

0

此问题与您的 kubernetes 配置有关,与您的 helm 无关。假设您也无法看到其他 helm 命令(例如helm list等)的输出。

很多人有这个问题是因为没有正确配置 CNI(通常是印花布)。有时会因为您的kubeconfig缺席而发生这种情况。

解决方案是:

  • 印花布迁移到法兰绒

  • --pod-network-cidr将使用 kubeadm 时的for calico更改192.168.0.0/16 to 172.16.0.0/16为初始化集群,例如kubeadm init --pod-network-cidr=172.16.0.0

您可以在类似的 github helm 问题上找到更多相关信息

简单的单机示例:

1)kubeadm init --pod-network-cidr=172.16.0.0/16

2)kubectl taint nodes --all node-role.kubernetes.io/master-

3)kubectl apply -f https://docs.projectcalico.org/v3.8/manifests/calico.yaml

configmap/calico-config created
customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org created
customresourcedefinition.apiextensions.k8s.io/networksets.crd.projectcalico.org created
clusterrole.rbac.authorization.k8s.io/calico-kube-controllers created
clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created
clusterrole.rbac.authorization.k8s.io/calico-node created
clusterrolebinding.rbac.authorization.k8s.io/calico-node created
daemonset.apps/calico-node created
serviceaccount/calico-node created
deployment.apps/calico-kube-controllers created
serviceaccount/calico-kube-controllers created

4)安装头盔

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller

5)创建和安装图表

$ helm create demo
Creating demo
$ helm install --name web ./demo
NAME:   web
LAST DEPLOYED: Tue Jul 16 10:44:15 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Deployment
NAME      READY  UP-TO-DATE  AVAILABLE  AGE
web-demo  0/1    1           0          0s

==> v1/Pod(related)
NAME                       READY  STATUS             RESTARTS  AGE
web-demo-6986c66d7d-vctql  0/1    ContainerCreating  0         0s

==> v1/Service
NAME      TYPE       CLUSTER-IP      EXTERNAL-IP  PORT(S)  AGE
web-demo  ClusterIP  10.106.140.176  <none>       80/TCP   0s


NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=demo,app.kubernetes.io/instance=web" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl port-forward $POD_NAME 8080:80

6)结果

$ kubectl get all
NAME                            READY   STATUS    RESTARTS   AGE
pod/web-demo-6986c66d7d-vctql   1/1     Running   0          75s


NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1        <none>        443/TCP   11m
service/web-demo     ClusterIP   10.106.140.176   <none>        80/TCP    75s


NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/web-demo   1/1     1            1           75s

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/web-demo-6986c66d7d   1         1         1       75s

您可以在使用 Minikube 开始使用 Kubernetes 文章中找到有关如何配置 helm 和 kubernetes 本身的更多信息

于 2019-07-16T10:46:15.327 回答