Creation de Cluster
Creation de Cluster
Creation de Cluster
# apt-get update
# swapoff -a
# nano /etc/hostname
exec bash
exec bash
# nano /etc/hosts
192.168.100.100 master
192.168.100.101 slave
# sudo apt-get install openssh-server
$ssh-keygen -t rsa -b 4096 -C "102Chedi"
$ ssh-agent
$ ssh-copy-id [email protected]
# apt-get update
# apt-get install -y docker.io
$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config
$ kubectl proxy
$ kubectl create serviceaccount dashboard -n default
$ kubectl create clusterrolebinding dashboard-admin -n default --clusterrole=cluster-admin
--serviceaccount=default:dashboard
$ kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath="{.secrets[0].name}")
-o jsonpath="{.data.token}" | base64 --decode
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-
dashboard:/proxy/
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "formulaire",
"namespace": "default",
"selfLink": "/apis/extensions/v1beta1/namespaces/default/deployments/formulaire",
"uid": "457a472b-2c1c-4e65-ac7e-6208b24c8e48",
"resourceVersion": "27961",
"generation": 1,
"creationTimestamp": "2019-07-04T19:34:36Z",
"labels": {
"k8s-app": "formulaire"
},
"annotations": {
"deployment.kubernetes.io/revision": "1"
}
},
"spec": {
"replicas": 2,
"selector": {
"matchLabels": {
"k8s-app": "formulaire"
}
},
"template": {
"metadata": {
"name": "formulaire",
"creationTimestamp": null,
"labels": {
"k8s-app": "formulaire"
}
},
"spec": {
"containers": [
{
"name": "formulaire",
"image": "nyezza/formulaire",
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "Always",
"securityContext": {
"privileged": true
}
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {},
"schedulerName": "default-scheduler"
}
},
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxUnavailable": "25%",
"maxSurge": "25%"
}
},
"revisionHistoryLimit": 10,
"progressDeadlineSeconds": 600
},
"status": {
"observedGeneration": 1,
"replicas": 2,
"updatedReplicas": 2,
"unavailableReplicas": 2,
"conditions": [
{
"type": "Available",
"status": "False",
"lastUpdateTime": "2019-07-04T19:34:37Z",
"lastTransitionTime": "2019-07-04T19:34:37Z",
"reason": "MinimumReplicasUnavailable",
"message": "Deployment does not have minimum availability."
},
{
"type": "Progressing",
"status": "True",
"lastUpdateTime": "2019-07-04T19:34:37Z",
"lastTransitionTime": "2019-07-04T19:34:36Z",
"reason": "ReplicaSetUpdated",
"message": "ReplicaSet \"formulaire-59bc6f56b\" is progressing."
}
]
}
}
kind: Deployment
apiVersion: formulaire/v1
metadata:
labels:
app: formulaire
name: formulaire
namespace: default
spec:
replicas: 3
selector:
matchLabels:
app: formulaire
template:
metadata:
labels:
app: formulaire
spec:
containers:
- name: hello
image: docker.io/nyezza/formulaire:34
imagePullPolicy: Always
ports:
- name: http
containerPort: 80
- name: health
containerPort: 81
args:
livenessProbe:
httpGet:
path: /healthz
port: 81
scheme: HTTP
initialDelaySeconds: 15
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /readiness
port: 81
scheme: HTTP
nitialDelaySeconds: 5
timeoutSeconds: 1