terraform-k8s/notes

99 lines
3.3 KiB
Plaintext
Raw Normal View History

2019-08-08 19:20:54 +00:00
# kubeadm config images pull
# kubeadm init phase preflight
# kubeadm init phase certs all --apiserver-advertise-address 2001:470:6d:22c:42::1 --apiserver-cert-extra-sans k8s-master.e2m
# kubeadm init phase kubeconfig all --apiserver-advertise-address 2001:470:6d:22c:42::1 --node-name k8s-master.e2m
# kubeadm init phase kubelet-start
# echo "KUBELET_KUBEADM_ARGS="--cgroup-driver=systemd --network-plugin=kubenet --pod-infra-container-image=k8s.gcr.io/pause:3.1"" > /var/lib/kubelet/kubeadm-flags.env
# kubeadm init phase control-plane all
# kubeadm init phase upload-certs --config=kubeadm-master-config.cfg --upload-certs
# kubeadm init phase mark-control-plane --config kubeadm-master-config.cfg
# kubeadm init phase bootstrap-token --config kubeadm-master-config.cfg
# kubeadm init phase upload-config all --config kubeadm-master-config.cfg
# kubeadm init phase addon all --config kubeadm-master-config.cfg --apiserver-advertise-address 2001:470:6d:22c:42::1 --pod-network-cidr 2001:470:6d:22c:42::/80 --service-cidr 2001:470:6d:22c:49::/80
--------------------------------------------------------------------------------------------------------------
08:14 <hybris> weil wenn wir --network-plugin=kubenet nutzen moechten muessen wir mit kubeadm die einzelnen phasen einzeln ausfuehren
08:14 <hybris> https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init-phase/#cmd-phase-kubelet-start
08:15 <hybris> die 'phase kubelet-start' erstellt dir dann die file /var/lib/kubelet/kubeadm-flags.env wo per default '--network-plugin=cni' drinsteht
20:34 <mue> wennde das mal auch noch in ne wikiseite packst, waer super, uebermorgen hab ich das iweder vergessen
--------------------------------------------------------------------------------------------------------------
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
--------------------------------------------------------------------------------------------------------------
/etc/cni/net.d/10-bridge-v6.conf
```json
{
"cniVersion": "0.3.0",
"name": "mynet",
"type": "bridge",
"bridge": "cbr0",
"isDefaultGateway": true,
"ipMasq": true,
"hairpinMode": true,
"ipam": {
"type": "host-local",
"ranges": [
[
{
"subnet": "2001:470:6d:22c:42::/80",
"gateway": "2001:470:6d:22c::1"
}
]
]
}
}
```
ansible snippet
```yaml
- name: create cni config directory
file:
path: /etc/cni/net.d
state: directory
- name:
template:
src: ../files/kubenet-config.json.conf
dest: /etc/cni/net.d/10-bridge-v6.conf
```
--------------------------------------------------------------------------------------------------------------
~/kubeadm_v6.cfg
```
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
kubernetesVersion: v1.15.1
apiServer:
extraArgs:
advertise-address: 2001:470:6d:22c:42::1
anonymous-auth: "false"
enable-admission-plugins: AlwaysPullImages,DefaultStorageClass
controllerManager:
extraArgs:
bind-address: ::1
```
--------------------------------------------------------------------------------------------------------------
/var/lib/kubelet/kubeadm-flags.env
```
KUBELET_KUBEADM_ARGS="--cgroup-driver=systemd --network-plugin=kubenet --pod-infra-container-image=k8s.gcr.io/pause:3.1"
```