Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
9efbeb11
Unverified
Commit
9efbeb11
authored
May 28, 2019
by
Erik Wilson
Committed by
GitHub
May 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #487 from itwars/master
Ansible - fix typo and add kubeconfig copy to user homedir
parents
1586e8d6
94da7fae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
6 deletions
+28
-6
README.md
contrib/ansible/README.md
+6
-1
main.yml
contrib/ansible/roles/k3s/master/tasks/main.yml
+22
-5
No files found.
contrib/ansible/README.md
View file @
9efbeb11
# Build a Kubernetes cluster using k3s via Ansible.
Author: https://github.com/itwars
## K3s Ansible Playbook
Build a Kubernetes cluster using Ansible with k3s. The goal is easily install a Kubernetes cluster on machines running:
...
...
@@ -38,6 +40,9 @@ node
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
contrib/ansible/roles/k3s/master/tasks/main.yml
View file @
9efbeb11
...
...
@@ -16,7 +16,7 @@
state
:
restarted
enabled
:
yes
-
name
:
Register file access mode
-
name
:
Register
node-token
file access mode
stat
:
path
:
/var/lib/rancher/k3s/server
register
:
p
...
...
@@ -26,18 +26,35 @@
path
:
/var/lib/rancher/k3s/server
mode
:
"
g+rx,o+rx"
-
name
:
Read
Node Token from M
aster
-
name
:
Read
node-token from m
aster
slurp
:
src
:
/var/lib/rancher/k3s/server/node-token
register
:
node_token
-
name
:
Store Master
T
oken
-
name
:
Store Master
node-t
oken
set_fact
:
token
:
"
{{
node_token.content
|
b64decode
|
regex_replace('
\n
',
'')
}}"
-
name
:
Restore file access
-
name
:
Restore
node-token
file access
file
:
path
:
/var/lib/rancher/k3s/server
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'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment