I am new in Rancher. My purpose of using it is to manage a k8s cluster.
I am using MacBook Pro with M2 chip. I would like to run Rancher container on my Docker Desktop environment.
So, I followed the quick-start guide to spin up the Rancher container, based on the guide, I only need to run the following command on my laptop:
$ sudo docker run --privileged -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
I can see the container is running successfully:
~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
871b54fb1003 rancher/rancher "entrypoint.sh" 1 hours ago Up 1 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp youthful_villani
But when I try to access http://localhost:80 or https://localhost , there is no response:
Why is that? What am I missing to spin up Rancher in my local environment?
The logs of the container:
...
2023-05-09 11:04:44 2023/05/09 08:04:44 [INFO] dynamic schema for kontainerdriver azurekubernetesservice updating
2023-05-09 11:04:45 2023/05/09 08:04:45 [INFO] Refreshing driverMetadata in 1440 minutes
2023-05-09 11:04:45 2023/05/09 08:04:45 [INFO] getReleaseConfig: reloading config for k3s
2023-05-09 11:04:45 2023/05/09 08:04:45 [INFO] getReleaseConfig: reloading config for rke2
2023-05-09 11:04:46 2023/05/09 08:04:46 [INFO] driverMetadata: refreshing data from upstream https://releases.rancher.com/kontainer-driver-metadata/dev-v2.7/data.json
2023-05-09 11:04:46 2023/05/09 08:04:46 [INFO] Retrieve data.json from local path /var/lib/rancher-data/driver-metadata/data.json
2023-05-09 11:04:48 2023/05/09 08:04:48 [INFO] Loaded configuration from https://releases.rancher.com/kontainer-driver-metadata/dev-v2.7/data.json in [0x70202b0]
2023-05-09 11:04:48 2023/05/09 08:04:48 [INFO] Loaded configuration from https://releases.rancher.com/kontainer-driver-metadata/dev-v2.7/data.json in [0x70202b0]
2023-05-09 11:04:48 2023/05/09 08:04:48 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cattle-fleet-system
2023-05-09 11:04:48 2023/05/09 08:04:48 [ERROR] namespaceHandler: Sync: error adding project id label to namespace err=Operation cannot be fulfilled on namespaces "cattle-fleet-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:04:48 2023/05/09 08:04:48 [ERROR] defaultSvcAccountHandler: Sync: error handling default ServiceAccount of namespace key=cattle-fleet-system, err=Operation cannot be fulfilled on namespaces "cattle-fleet-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:04:48 2023/05/09 08:04:48 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cattle-fleet-system
2023-05-09 11:04:48 2023/05/09 08:04:48 [ERROR] defaultSvcAccountHandler: Sync: error handling default ServiceAccount of namespace key=cattle-fleet-system, err=Operation cannot be fulfilled on namespaces "cattle-fleet-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:04:48 2023/05/09 08:04:48 [ERROR] defaultSvcAccountHandler: Sync: error handling default ServiceAccount of namespace key=cattle-fleet-system, err=Operation cannot be fulfilled on namespaces "cattle-fleet-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:17 2023/05/09 08:05:17 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cattle-fleet-clusters-system
2023-05-09 11:05:17 2023/05/09 08:05:17 [ERROR] namespaceHandler: Sync: error adding project id label to namespace err=Operation cannot be fulfilled on namespaces "cattle-fleet-clusters-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:17 2023/05/09 08:05:17 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cattle-fleet-clusters-system
2023-05-09 11:05:17 2023/05/09 08:05:17 [ERROR] defaultSvcAccountHandler: Sync: error handling default ServiceAccount of namespace key=cattle-fleet-clusters-system, err=Operation cannot be fulfilled on namespaces "cattle-fleet-clusters-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=BundleDeployment
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=BundleNamespaceMapping
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=ClusterGroup
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for gitjob.cattle.io/v1, Kind=GitJob
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=ClusterRegistration
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=GitRepo
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=Content
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=GitRepoRestriction
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=ClusterRegistrationToken
2023-05-09 11:05:25 2023/05/09 08:05:25 [INFO] Watching metadata for fleet.cattle.io/v1alpha1, Kind=ImageScan
2023-05-09 11:05:36 2023/05/09 08:05:36 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cluster-fleet-local-local-1a3d67d0a899
2023-05-09 11:05:36 2023/05/09 08:05:36 [ERROR] namespaceHandler: Sync: error adding project id label to namespace err=Operation cannot be fulfilled on namespaces "cluster-fleet-local-local-1a3d67d0a899": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:36 2023/05/09 08:05:36 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cluster-fleet-local-local-1a3d67d0a899
2023-05-09 11:05:40 2023/05/09 08:05:40 [ERROR] defaultSvcAccountHandler: Sync: error handling default ServiceAccount of namespace key=cattle-fleet-local-system, err=Operation cannot be fulfilled on namespaces "cattle-fleet-local-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:40 2023/05/09 08:05:40 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cattle-fleet-local-system
2023-05-09 11:05:40 2023/05/09 08:05:40 [ERROR] namespaceHandler: Sync: error adding project id label to namespace err=Operation cannot be fulfilled on namespaces "cattle-fleet-local-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:40 2023/05/09 08:05:40 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cattle-fleet-local-system
2023-05-09 11:05:40 2023/05/09 08:05:40 [ERROR] namespaceHandler: Sync: error adding project id label to namespace err=Operation cannot be fulfilled on namespaces "cattle-fleet-local-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:40 2023/05/09 08:05:40 [ERROR] defaultSvcAccountHandler: Sync: error handling default ServiceAccount of namespace key=cattle-fleet-local-system, err=Operation cannot be fulfilled on namespaces "cattle-fleet-local-system": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:40 2023/05/09 08:05:40 [INFO] namespaceHandler: addProjectIDLabelToNamespace: adding label field.cattle.io/projectId=p-k2flm to namespace=cattle-fleet-local-system
2023-05-09 11:05:40 2023/05/09 08:05:40 [ERROR] defaultSvcAccountHandler: error updating default service account flag for namespace: cattle-fleet-local-system, err=Operation cannot be fulfilled on serviceaccounts "default": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:40 2023/05/09 08:05:40 [ERROR] defaultSvcAccountHandler: Sync: error handling default ServiceAccount of namespace key=cattle-fleet-local-system, err=Operation cannot be fulfilled on serviceaccounts "default": the object has been modified; please apply your changes to the latest version and try again
2023-05-09 11:05:53 2023/05/09 08:05:53 [ERROR] error syncing 'local': handler cluster-secret-migrator: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", requeuing
2023-05-09 11:05:53 2023/05/09 08:05:53 [ERROR] error syncing 'local': handler cluster-stats: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", handler cluster-secret-migrator: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", requeuing
2023-05-09 11:05:53 2023/05/09 08:05:53 [ERROR] error syncing 'local': handler cluster-stats: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", handler cluster-secret-migrator: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", requeuing
2023-05-09 11:05:54 2023/05/09 08:05:54 [ERROR] error syncing 'local': handler cluster-stats: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", handler cluster-secret-migrator: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", requeuing
2023-05-09 11:05:54 2023/05/09 08:05:54 [ERROR] error syncing 'local': handler cluster-stats: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", handler cluster-secret-migrator: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", requeuing
2023-05-09 11:05:55 2023/05/09 08:05:55 [ERROR] error syncing 'local': handler cluster-stats: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", handler cluster-secret-migrator: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", requeuing
2023-05-09 11:05:56 2023/05/09 08:05:56 [ERROR] error syncing 'local': handler cluster-stats: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", handler cluster-secret-migrator: Internal error occurred: failed calling webhook "rancher.cattle.io.clusters.management.cattle.io": failed to call webhook: Post "https://rancher-webhook.cattle-system.svc:443/v1/webhook/mutation/clusters.management.cattle.io?timeout=10s": no endpoints available for service "rancher-webhook", requeuing
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] starting duplicate binding cleanup
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] [clean-dupe-bindings] starting bindings cleanup
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] [clean-dupe-bindings] total PRTB duplicate clusterRoleBindings 0, roleBindings 0
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] [clean-dupe-bindings] binding with deterministic name not found, will delete all except the oldest binding
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] [clean-dupe-bindings] binding with deterministic name not found, will delete all except the oldest binding
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] [clean-dupe-bindings] binding with deterministic name not found, will delete all except the oldest binding
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] [clean-dupe-bindings] binding with deterministic name not found, will delete all except the oldest binding
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] [clean-dupe-bindings] total CRTB duplicate clusterRoleBindings 0, roleBindings 0
2023-05-09 11:07:22 2023/05/09 08:07:22 [INFO] successfully cleaned up duplicate bindings
Run curl http://localhost:80 -v
on my local laptop shows this:
~ curl http://localhost:80 -v
* Trying 127.0.0.1:80...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.84.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Content-Type: text/html; charset=utf-8
< Location: https://localhost/
< Date: Wed, 10 May 2023 19:52:32 GMT
< Content-Length: 41
<
<a href="https://localhost/">Found</a>.
* Connection #0 to host localhost left intact
2
Answers
The possibile issues may be multiple:
scutil --proxy
networksetup -setv6off Ethernet
to disable IPv6 for ethernet ornetworksetup -setv6off Wi-Fi
for wireless network.Rancher is creating a self-signed certificate as described here:
curl
is working to port80
, and redirecting to port443
.The reason your browser and curl are failing on port
443
is that it is self-signed. If you installopenssl
client, you can see the details of the certificate Rancher generates:Here
verify return:1
means my system does not trust this certificate.The solution is to either trust the certificate authority that Rancher uses to automatically generate a certificate, both at the OS level and the browser level.
Alternatively, you can generate your own self-signed certificate, trust that on your machine and browser, and then bind it to the container.
A separate issue is Chrome(?) does not appear to be displaying the correct error page. This could be caused by a number of issues, most of which shouldn’t apply to
localhost
, however. I would recommend deleting all cached content or using a separate profile to have a clean slate to work with.