k3d入门指南:在Docker中运行K3s
发布日期:2021-05-15 07:09:07 浏览次数:16 分类:博客文章

本文共 9631 字,大约阅读时间需要 32 分钟。

������������������������������������k3d������������������������������������Docker������������������������������Kubernetes���������������������������������������������������������������k3d������������������������������������

���������k3d���

k3d���������������������������������Docker���������K3s��������� K3s���������CNCF������������������Kubernetes���������������������������������������������������������������������������������������������������������RAM������512MB��� ���������������K3s������������������������������������������������������������B������������������

k3d���������K3s���������������Docker������������������Docker���������������������Docker���������������������K3s��������� ������������������������������������������������Docker Host���������������������K3s������������������������������������server���agent���������

k3d���������������

2021���1������������k3dv4.0.0������������������������

  • ������/������/������/������/������/������K3s���������������������������
  • ���������������������
  • ������������������
  • ������������������������������������������������������������������
  • ���������������Kubeconfigs
  • ���������Docker daemon������������������������������������������������������

������������������������������������������������������������������������������������������

k3d���������������������

k3d���������������������������Kubernetes������������������������������k3d��������������������������������������������������������������������������������������������� ������k3d���������������������������������������������������������������������������������������������������������������������Kubernetes���������������������������������������������������������������������������������������������������docker-compose���������������Kubernetes������������������

������������������������k3d���������������������������������������������������������������������������Kubernetes���������������K3s������������ ���������������k3d������������������������������������������������������������������������������������������������������������������Kubernetes���������������������������������������������������������������������

������������������������������������������������k3d���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������k3d-dind���������������������������������������������������������������������������������������������������������������������������������������������������������������k3d���docker-in-docker������������������������Docker���������������K3s���������������������������������������������k3d-dind������������Docker���������������������������������������������������������K3s / Kubernetes���������

������������k3d���

1���������k3d���������������������������kubectl���

���������������������������������������������������������������k3d v4.1.1������������

2������������������������������������������������������������CLI���������������������������������������������k3d [command] --help���

���������������������

k3d cluster create

���������������������������������������������K3s���������������Kubernetes���������������������server������������������������������������������������serverlb������ ���������������������������������Docker������������������Docker���������������������������������������������Kubernetes API��� ������������������������������������Docker���������������������������������������

���������������������������������name������������������������������k3s-default���������������������������k3d-

-
-<#>������������������������������������������������ k3d- k3s-default-serverlb���k3d-k3s-default-server-0

k3d���������������������������������������������Kubeconfig���������������������Kubeconfig���������������������$ HOME / .kube / config������KUBECONFIG������������������������������������������

���������������������������������������������

������kubectl���������������������������������������������������. kubectl get nodes

k3d���������������������������������������������������������������.k3d cluster | node | registry list

������������������������������

k3d cluster create mycluster --api-port 127.0.0.1:6445 --servers 3 --agents 2 --volume '/home/me/mycode:/code@agent[*]' --port '8080:80@loadbalancer'

������������������������������������K3s���������* 1������������������* 3���server������������������������* 2���agent������������worker���������

������--api-port 127.0.0.1:6445������������������k3d���Kubernetes API���������6443������������������127.0.0.1 / localhost���������6445���������������������������Kubeconfig���������������������������������server: https://127.0.0.1:6445������������������������

������������������������������������������������������������������������������������������server������������������������������������������������������������������server������������������������������������������������������������������server������

--volume /home/me/mycode:/code@agent[] ���������������������������/home/me/mycode������������������[] agent ������������������������/code������������������0���1���������*������������������������������������������������

������k3d������������������������������������������������������������������������������������������������������������������������--port���������

���������������--port '8080:80@loadbalancer'������������������������8080���������������������������serverlb���������������80���������������������������������HTTP ingress������������������������ ������������������Web������������������������������Deployment������������������������������ Ingress������myapp.k3d.localhost���������������������Service������

������������������������������������������������������������������IP���������������������������������http://myapp.k3d.localhost:8080 ��������������������������� ������������������������������������Docker��������������������������������� ���������������������������������������������Ingress���Service���������������������������Pod���

������������������������������������������myapp.k3d.localhost���������������������IP���127.0.0.1������

������������������������������/etc/hosts���������������127.0.0.1
myapp.k3d.localhost������������C:\Windows\System32\drivers\etc/hosts���������
���������������������������������������.localhost������������������������������������������������������������������������������������dnsmasq���MacOS /
UNIX������Acrylic���Windows������������������������������������ ������������������������������������������Linux���������������������SUSE
Linux���openSUSE������������libnss-myhostname������������������
.localhost������������������127.0.0.1������������������������������������������������
������������������������Ingress���������������������������������������������

������������������������������������������������������server������������K3s���������������--cluster-init���������������������������K3s������������������������������������SQLite������������etcd���

���������������������������

���k3d v4.0.0������������2021���1������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������repo������������������������������������JSON���������

���������������������

# k3d configuration file, saved as e.g. /home/me/myk3dcluster.yamlapiVersion: k3d.io/v1alpha2  # this will change in the future as we make everything more stablekind: Simple  # internally, we also have a Cluster config, which is not yet available externallyname: mycluster  # name that you want to give to your cluster (will still be prefixed with `k3d-`)servers: 1  # same as `--servers 1`agents: 2  # same as `--agents 2`kubeAPI:  # same as `--api-port 127.0.0.1:6445`  hostIP: "127.0.0.1"  hostPort: "6445"ports:  - port: 8080:80  # same as `--port 8080:80@loadbalancer    nodeFilters:      - loadbalanceroptions:  k3d:  # k3d runtime settings    wait: true  # wait for cluster to be usable before returining; same as `--wait` (default: true)    timeout: "60s"  # wait timeout before aborting; same as `--timeout 60s`  k3s:  # options passed on to K3s itself    extraServerArgs:  # additional arguments passed to the `k3s server` command      - --tls-san=my.host.domain    extraAgentArgs: []  # addditional arguments passed to the `k3s agent` command  kubeconfig:    updateDefaultKubeconfig: true  # add new cluster to your default Kubeconfig; same as `--kubeconfig-update-default` (default: true)switchCurrentContext: true  # also set current-context to the new cluster's context; same as `--kubeconfig-switch-context` (default: true)

���������������������������/home/me/myk3dcluster.yaml������������������������������������������

k3d cluster create --config /home/me/myk3dcluster.yaml

������������������������������������������������������������������������������������������������������������������������������������������������������������

k3d������������������

���������������������������������k3d������������

  • ���k3d���������������������������������������
  • ���������������������������������������������������
  • ���k3d������������������������������Tilt���Skaffold���������������
  • ���������������������k3d image import���������������������������
  • ���������������������k3d������������������������������������
  • ���������CI���������������k3d������������������������PoC���
  • ���������������������vscode���������������
  • vscode��������������� ���������������K3s���������������

���������������������������demo repo���������������������������������������������������������

THORSTEN KLEIN

trivago���DevOps������������SUSE������������������������������k3d���������������

上一篇:C++小游戏tankwar:(一)、界面绘制
下一篇:C语言进阶之旅(7)操作符

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2025年05月05日 07时03分47秒