Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
K3S Ansible
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitriy Safronov
K3S Ansible
Commits
4abaf356
Commit
4abaf356
authored
6 years ago
by
Vincent RABAH (itwars)
Browse files
Options
Downloads
Patches
Plain Diff
Fix typo and add kubeconfig copy to user homedir
parent
cf0b3067
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+6
-1
6 additions, 1 deletion
README.md
roles/k3s/master/tasks/main.yml
+22
-5
22 additions, 5 deletions
roles/k3s/master/tasks/main.yml
with
28 additions
and
6 deletions
README.md
+
6
−
1
View file @
4abaf356
# Build a Kubernetes cluster using k3s via Ansible.
# Build a Kubernetes cluster using k3s via Ansible.
https://github.com/itwars
## K3s Ansible Playbook
## K3s Ansible Playbook
Build a Kubernetes cluster using Ansible with k3s. The goal is easily install a Kubernetes cluster on machines running:
Build a Kubernetes cluster using Ansible with k3s. The goal is easily install a Kubernetes cluster on machines running:
...
@@ -38,6 +40,9 @@ node
...
@@ -38,6 +40,9 @@ node
Start provisioning of the cluster using the following command:
Start provisioning of the cluster using the following command:
```
```
ansible-playbook site.y
a
ml
ansible-playbook site.yml
```
```
## Kubeconfig
To get access to your
**Kubernetes**
cluster just scp debian@master_pi:~/kube/config ~/.kube/config
This diff is collapsed.
Click to expand it.
roles/k3s/master/tasks/main.yml
+
22
−
5
View file @
4abaf356
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
state
:
restarted
state
:
restarted
enabled
:
yes
enabled
:
yes
-
name
:
Register file access mode
-
name
:
Register
node-token
file access mode
stat
:
stat
:
path
:
/var/lib/rancher/k3s/server
path
:
/var/lib/rancher/k3s/server
register
:
p
register
:
p
...
@@ -26,18 +26,35 @@
...
@@ -26,18 +26,35 @@
path
:
/var/lib/rancher/k3s/server
path
:
/var/lib/rancher/k3s/server
mode
:
"
g+rx,o+rx"
mode
:
"
g+rx,o+rx"
-
name
:
Read
N
ode
T
oken from
M
aster
-
name
:
Read
n
ode
-t
oken from
m
aster
slurp
:
slurp
:
src
:
/var/lib/rancher/k3s/server/node-token
src
:
/var/lib/rancher/k3s/server/node-token
register
:
node_token
register
:
node_token
-
name
:
Store Master
T
oken
-
name
:
Store Master
node-t
oken
set_fact
:
set_fact
:
token
:
"
{{
node_token.content
|
b64decode
|
regex_replace('
\n
',
'')
}}"
token
:
"
{{
node_token.content
|
b64decode
|
regex_replace('
\n
',
'')
}}"
-
name
:
Restore file access
-
name
:
Restore
node-token
file access
file
:
file
:
path
:
/var/lib/rancher/k3s/server
path
:
/var/lib/rancher/k3s/server
mode
:
"
{{
p.stat.mode
}}"
mode
:
"
{{
p.stat.mode
}}"
#- debug: msg="Node TOKEN {{ token }}"
-
name
:
Create directory .kube
file
:
path
:
/home/{{ ansible_user }}/.kube
state
:
directory
owner
:
"
{{
ansible_user
}}"
-
name
:
Copy config file to user home directory
copy
:
src
:
/etc/rancher/k3s/k3s.yaml
dest
:
/home/{{ ansible_user }}/.kube/config
remote_src
:
yes
owner
:
"
{{
ansible_user
}}"
-
name
:
Replace https://localhost:6443 by https://master-pi:6443
replace
:
path
:
/home/{{ ansible_user }}/.kube/config
regexp
:
'
https://localhost:6443'
replace
:
'
https://{{master_ip}}:6443'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment