使用docker-compose启动的Rancher 2.x的证书管理器创建颁发者

时间:2018-07-04 15:55:29

标签: docker kubernetes lets-encrypt rancher kubernetes-helm

我正在测试Rancher 2作为Kubernetes界面。使用图像rancher / rancher:latest和docker-compose启动Rancher 2。

对于群集,节点和Pod,一切都很好。然后,我尝试使用证书保护某些负载均衡器。这样做,我从目录/ helm安装了cert-manager。

enter image description here

我已尝试遵循此视频教程(https://www.youtube.com/watch?v=xc8Jg9ItDVk),该视频教程介绍了如何创建颁发者和证书,以及如何将其链接到负载均衡器。

我为发行者创建了一个文件:

apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer
metadata:
  name: letsencrypt
spec:
  acme:
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    email: root@example.com
    privateKeySecretRef:
      name: letsencrypt-private-key
    http01: {}

是时候创建发行人了。

sudo docker-compose exec rancher bash

我已连接到Rancher容器。 kubectlhelm已安装。

我尝试创建发行人:

kubectl create -f etc/cert-manager/cluster-issuer.yaml
error: unable to recognize "etc/cert-manager/cluster-issuer.yaml": no matches for certmanager.k8s.io/, Kind=ClusterIssuer

其他信息:

当我做helm list时:

Error: could not find a ready tiller pod

我让豆荚找到分er:

kubectl get pods
NAME                             READY     STATUS    RESTARTS   AGE
tiller-deploy-6ffc49c5df-zbjg8   0/1       Pending   0          39m

我描述了这个吊舱:

kubectl describe pod tiller-deploy-6ffc49c5df-zbjg8
Name:           tiller-deploy-6ffc49c5df-zbjg8
Namespace:      default
Node:           <none>
Labels:         app=helm
                name=tiller
                pod-template-hash=2997057189
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"tiller-deploy-6ffc49c5df","uid":"46f74523-7f8f-11e8-9d04-0242ac1...
Status:         Pending
IP:
Created By:     ReplicaSet/tiller-deploy-6ffc49c5df
Controlled By:  ReplicaSet/tiller-deploy-6ffc49c5df
Containers:
  tiller:
    Image:      gcr.io/kubernetes-helm/tiller:v2.8.0-rancher3
    Ports:      44134/TCP, 44135/TCP
    Liveness:   http-get http://:44135/liveness delay=1s timeout=1s period=10s #success=1 #failure=3
    Readiness:  http-get http://:44135/readiness delay=1s timeout=1s period=10s #success=1 #failure=3
    Environment:
      TILLER_NAMESPACE:    default
      TILLER_HISTORY_MAX:  0
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from tiller-token-hbfgz (ro)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  tiller-token-hbfgz:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  tiller-token-hbfgz
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.alpha.kubernetes.io/notReady:NoExecute for 300s
                 node.alpha.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                 From               Message
  ----     ------            ----                ----               -------
  Warning  FailedScheduling  4m (x125 over 39m)  default-scheduler  no nodes available to schedule pods

这个问题有点具体:rancher / kubernetes / docker-compose ...如果有人有什么想法,不客气;)

谢谢!

1 个答案:

答案 0 :(得分:1)

我刚刚找到了可以解除这种情况的信息。

感谢https://www.idealcoders.com/posts/rancher/2018/06/rancher-2-x-and-lets-encrypt-with-cert-manager-and-nginx-ingress/

第一步是加载集群的配置。我正在使用默认群集。因此,

  1. 我在docker容器中执行bash
  2. 我加载了配置文件/root/.kube/config
  3. 更新配置
  4. 继续...发行人已正确创建。

如果可以帮助某人;)