【问题案例】K8S-Master修改IP地址之后,重新初始化的方法。
使用kubeadm命令,执行:kubeadm reset
重新执行初始化:kubeadm init --kubernetes-version=v1.14.1 --pod-network-cidr=10.245.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
执行完上述的几个命令,理论上K8S已经启动了,但是由于Flannel没有安装,导致node节点依然是notReady状态。执行如下命令,创建Flannel守护进程。(我前面已经安装并导入了Flannel的镜像)
docker load -i flannel-dashboard.tar.gz
[root@k8s-node ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
k8s.gcr.io/kube-proxy v1.14.1 20a2d7035165 months ago .1MB
k8s.gcr.io/kube-apiserver v1.14.1 cfaa4ad74c37 months ago 210MB
k8s.gcr.io/kube-scheduler v1.14.1 8931473d5bdb months ago .6MB
k8s.gcr.io/kube-controller-manager v1.14.1 efb3887b411d months ago 158MB
quay.io/coreos/flannel v0.11.0-amd64 ff281650a721 months ago .6MB
k8s.gcr.io/coredns 1.3. eb516548c180 months ago .3MB
k8s.gcr.io/kubernetes-dashboard-amd64 v1.10.1 f9aed6605b81 months ago 122MB
k8s.gcr.io/etcd 3.3. 2c4adeb21b4f months ago 258MB
k8s.gcr.io/pause 3.1 da86e6ba6ca1 months ago 742kB
kubectl create -f /opt/k8s/kube-flannel.yaml
[root@k8s-node ~]# cat /opt/k8s/kube-flannel.yaml
---
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: psp.flannel.unprivileged
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default
seccomp.security.alpha.kubernetes.io/defaultProfileName: docker/default
apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default
apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default
spec:
privileged: false
volumes:
- configMap
- secret
- emptyDir
- hostPath
allowedHostPaths:
- pathPrefix: "/etc/cni/net.d"
- pathPrefix: "/etc/kube-flannel"
- pathPrefix: "/run/flannel"
readOnlyRootFilesystem: false
# Users and groups
runAsUser:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
fsGroup:
rule: RunAsAny
# Privilege Escalation
allowPrivilegeEscalation: false
defaultAllowPrivilegeEscalation: false
# Capabilities
allowedCapabilities: ['NET_ADMIN']
defaultAddCapabilities: []
requiredDropCapabilities: []
# Host namespaces
hostPID: false
hostIPC: false
hostNetwork: true
hostPorts:
- min:
max:
# SELinux
seLinux:
# SELinux is unsed in CaaSP
rule: 'RunAsAny'
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: flannel
rules:
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames: ['psp.flannel.unprivileged']
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- nodes/status
verbs:
- patch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: flannel
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: flannel
subjects:
- kind: ServiceAccount
name: flannel
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: flannel
namespace: kube-system
---
kind: ConfigMap
apiVersion: v1
metadata:
name: kube-flannel-cfg
namespace: kube-system
labels:
tier: node
app: flannel
data:
cni-conf.json: |
{
"name": "cbr0",
"plugins": [
{
"type": "flannel",
"delegate": {
"hairpinMode": true,
"isDefaultGateway": true
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
}
]
}
net-conf.json: |
{
"Network": "10.245.0.0/16",
"Backend": {
"Type": "vxlan"
}
}
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: kube-flannel-ds-amd64
namespace: kube-system
labels:
tier: node
app: flannel
spec:
template:
metadata:
labels:
tier: node
app: flannel
spec:
hostNetwork: true
nodeSelector:
beta.kubernetes.io/arch: amd64
tolerations:
- operator: Exists
effect: NoSchedule
serviceAccountName: flannel
initContainers:
- name: install-cni
image: quay.io/coreos/flannel:v0.11.0-amd64
command:
- cp
args:
- -f
- /etc/kube-flannel/cni-conf.json
- /etc/cni/net.d/-flannel.conflist
volumeMounts:
- name: cni
mountPath: /etc/cni/net.d
- name: flannel-cfg
mountPath: /etc/kube-flannel/
containers:
- name: kube-flannel
image: quay.io/coreos/flannel:v0.11.0-amd64
command:
- /opt/bin/flanneld
args:
- --ip-masq
- --kube-subnet-mgr
resources:
requests:
cpu: "100m"
memory: "50Mi"
limits:
cpu: "100m"
memory: "50Mi"
securityContext:
privileged: false
capabilities:
add: ["NET_ADMIN"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: run
mountPath: /run/flannel
- name: flannel-cfg
mountPath: /etc/kube-flannel/
volumes:
- name: run
hostPath:
path: /run/flannel
- name: cni
hostPath:
path: /etc/cni/net.d
- name: flannel-cfg
configMap:
name: kube-flannel-cfg
【问题案例】K8S-Master修改IP地址之后,重新初始化的方法。的更多相关文章
- CentOS(RedHat)命令行永久修改IP地址、网关、DNS
1.修改IP地址vim /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0 #网卡名称BOOTPROTO=static #获取ip的方式(stat ...
- Linux下如何修改ip地址
在Linux的系统下如何才能修改IP信息 以前总是用ifconfig修改,重启后总是得重做.如果修改配置文件,就不用那么麻烦了- A.修改ip地址 即时生效: # ifconfig eth0 192. ...
- Delphi 调用netsh命令修改IP地址
Delphi 调用netsh命令修改IP地址 先介绍一下Netsh命令的使用方法: 在这里跟大家介绍几个简单的指令 1.Show IP 1.1Cmd Mode 直接在cmd下面输入 netsh int ...
- CentOS 修改IP地址, DNS, 网关
一.CentOS 修改IP地址 修改对应网卡的IP地址的配置文件# vi /etc/sysconfig/network-scripts/ifcfg-eth0 修改以下内容DEVICE=eth0 #描述 ...
- 注册表修改IP地址和DNS等信息
---------------------win8系统 1. 2. 3. --------------------------------------------------------------- ...
- Ubuntu配置和修改IP地址
Ubuntu配置和修改IP地址 1.修改配置文件/etc/network/interfacesroot@ubuntu:~# sudo gedit /etc/network/interfaces 添加以 ...
- linux下修改ip地址,默认网关以及DNS
*修改IP地址 即时生效: ifconfig eth0 192.168.1.100 netmask 255.255.255.0 重启生效: vim /etc/sysconfig/network-s ...
- Windows下通过脚本快速修改IP地址
Windows下通过脚本快速修改IP地址 如果通过Windows的网络属性修改Ip/网关,真是太麻烦了. 经常要切换ip,所以我写了两个脚本: c:\办公室.bat netsh interface i ...
- 网络知识汇总(2) - Linux下如何修改ip地址
在Linux的系统下如何才能修改IP信息 以前总是用ifconfig修改,重启后总是得重做.如果修改配置文件,就不用那么麻烦了- A.修改ip地址 即时生效: # ifconfig e ...
随机推荐
- 18-SQLServer中给视图创建索引
一.注意点 1.索引视图所引用的基表必须在同一个数据库中,不是用union all引用多个数据库的表: 2.创建索引视图时要加上with schemabinding: 3.创建索引视图时要指定表所属的 ...
- JDK、JRE、JVM的区别与关系
JDK JDK是Java开发工具包,是Sun Microsystems针对Java开发员的产品. JDK中包含JRE,在JDK的安装目录下有一个名为jre的目录,里面有两个文件夹bin和lib,在这里 ...
- python--openCV--图像处理
安装 pip3 install opencv-python 图像处理: import cv2 #导入opencv库 import numpy as np img = cv2.imread(" ...
- 4、docker镜像:花卷结构、commit镜像
1.是什么 docker images 镜像是一种轻量级.可执行的独立软件包,用来打包软件运行环境和基于运行环境开发的软件,它包含运行某个软件所需的所有内容,包括代码.运行时.库.环境变量和配置文件. ...
- VUE:Select2
<template> <div> <ul class="skill"> <li v-for='item of list' v-on:cli ...
- XHTML测试题
1.XHTML 指的是? A.EXtra Hyperlinks and Text Markup Language B.EXtensible HyperText Marking Language C.E ...
- SuperSocket实例
下载地址:https://files.cnblogs.com/files/xixixing/ConsoleApp.zip 创建控制台应用程序:ConsoleApp MySession.cs using ...
- 'telnet' is not recognized as an internal or external command
http://blog.csdn.net/lubinsu/article/details/7294870 使用telnet的时候出现如下提示:'telnet' is not recognized ...
- 洛谷 P5174 圆点
题面 感觉被侮辱智商了,这水题NM省选NOI-.... 直接枚举一维,另一维单调不增,然后直接算答案就可以了.... gan #include<bits/stdc++.h> #define ...
- 「SPOJ TTM 」To the moon「标记永久化」
题意 概括为主席树区间加区间询问 题解 记录一下标记永久化的方法.每个点存add和sum两个标记,表示这个区间整个加多少,区间和是多少(这个区间和不包括祖先结点区间加) 然后区间加的时候,给路上每结点 ...