Skip to content

Instantly share code, notes, and snippets.

View niiku-y's full-sized avatar

Yuuki Niikura niiku-y

  • Tokyo, Japan
View GitHub Profile
#!/bin/bash
# install_nginx_ubu16.sh
#
#usage)
# chmod +x install_nginx_ubu16.sh
# sudo bash ./install_nginx_ubu16.sh
listfile=/etc/apt/sources.list.d/nginx.list
if [ ! -f $listfile ]; then
#!/bin/bash
# install_rancher.sh
echo "before : "
helm repo list
echo ""
echo "repository add : "
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
#!/bin/bash
# install_helm.sh
echo "setup service account tiller ..."
kubectl -n kube-system create serviceaccount tiller
kubectl -n kube-system get sa tiller -o yaml
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
echo ""
echo "context : "
#!/bin/bash
# install_kubectl.sh
sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update && sudo apt-get install -y kubectl
echo "kubectl : "
#!/bin/bash
# copy_kubeconf_rancher.sh
HOSTLIST="master01 master02 master03"
for h in $HOSTLIST
do
scp kube_config_rancher-cluster.yml ubuntu@${h}:/home/ubuntu/
ssh ubuntu@${h} echo "export KUBECONFIG=/home/ubuntu/kube_config_rancher-cluster.yml" \>\> .profile
done
#!/bin/bash
# install_rke.sh
echo "install rke : "
wget https://github.com/rancher/rke/releases/download/v0.1.11/rke_linux-amd64
chmod +x rke_linux-amd64
sudo mv rke_linux-amd64 /usr/local/bin/rke
echo "rke : "
which rke
nodes:
- address: 192.168.0.109
user: ubuntu
ssh_key_path: /home/ubuntu/.ssh/id_rsa.pri.lb01
role: [controlplane,worker,etcd]
- address: 192.168.0.110
user: ubuntu
ssh_key_path: /home/ubuntu/.ssh/id_rsa.pri.lb01
role: [controlplane,worker,etcd]
- address: 192.168.0.111
#!/bin/bash
# postinst_before_rke.sh
#
#usage)
# ubuntu@lb01:~$ chmod +x postinst_before_rke.sh
# ubuntu@lb01:~$ sudo bash postinst_before_rke.sh
#
usr="ubuntu"
echo "group check : "
#!/bin/bash
#install_docker.sh
echo "dpkg -l docker : "
dpkg -l docker
sudo apt-get update
echo ""
echo "install apt-transport-https ca-certificates curl software-properties-common : "
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
#!/bin/bash
# copy_keyconf.sh
HOSTLIST="master01 master02 master03"
for h in $HOSTLIST
do
scp ~/.ssh/authorized_keys ubuntu@${h}:/home/ubuntu/.ssh/authorized_keys
scp ~/.ssh/config ubuntu@${h}:/home/ubuntu/.ssh/config
done