-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
一摸 k3s: 安装历程 #195
Labels
Comments
安装后出现的问题1. The connection to the server localhost:8080 was refused - did you specify the right host or port?这是 kubectl 的配置文件没有正确指向 k3s 集群导致的,检查以下几点:
|
Hello World 之 k3s本章节涉及到 pod, deployment, service, ingress, 算是一份配置文件快速启动一个可用的 k3s 应用。 1. 新建配置文件mkdir k8s-helloworld && cd k8s-helloworld
touch ping.yaml
再给配置文件填上内容: cat <<EOF >ping.yaml
apiVersion: v1
kind: Service
metadata:
name: ping-service
spec:
selector:
app: ping
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ping-deployment
labels:
app: ping
spec:
replicas: 3
selector:
matchLabels:
app: ping
template:
metadata:
labels:
app: ping
spec:
containers:
- name: ping
image: bpazy/ping:v1.0.0
ports:
- containerPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: traefik-ping
namespace: default
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: ping.me.k3s
http:
paths:
- path:
pathType: ImplementationSpecific
backend:
service:
name: ping-service
port:
number: 80
EOF 然后编辑本地 hosts 文件,填入 2. 使 k3s 应用该配置文件
稍等片刻,访问该域名: {
"addr":[
"10.42.0.34"
],
"message":"pong"
} |
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
安装
1. 安装 k3s
curl -sfL https://get.k3s.io | sh -
国内用户使用以下方法加速安装:
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -
2. 更改 k3s 中 containerd 默认镜像地址
因为 k3s 默认不使用 docker, 所以修改 docker 的 mirror 是没用的,这里我们需要修改 containerd mirror 地址:
输入:
重启 k3s:
The text was updated successfully, but these errors were encountered: