Page History
...
The basic step which can be followed to install the Kubernetes cluster on Centos are:
Install Docker on all CentOS 7 VMs
Update the package database
Code Block sudo yum check-update
Install the dependencies
Code Block sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Add and enable the official Docker Repository to CentOS 7
Code Block sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install the latest Docker version on CentOS 7
Code Block sudo yum install docker-ce
A successful installation output will be concluded with a
Complete!
You may be prompted to accept the GPG key. This is to verify that the fingerprint matches. The format will look as follows. If correct, accept it.Code Block 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
Manage Docker service
Now Docker is installed, but the service is not yet running. Start and enable Docker using the commands.Code Block sudo systemctl start docker sudo systemctl enable docker
To confirm that Docker is active and running use:
Code Block sudo systemctl status docker
Set up the Kubernetes Repository
Since the Kubernetes packages aren’t present in the official CentOS 7 repositories, we will need to add a new repository file. Use the following command to create the file and open it for editing:
Code Block sudo vi /etc/yum.repos.d/kubernetes.repo
Once the file is open, press I key to enter insert mode, and paste the following contents:
Code Block [kubernetes] name=Kubernetes baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
Once pasted, press escape to exit insert mode. Then enter
:x
to save the file and exit.
Install Kubelet on CentOS 7
The first core module that we need to install on every node is Kubelet. Use the following command to do so:
Code Block sudo yum install -y kubelet
Install kubeadm and kubectl on CentOS 7
kubeadm, the next core module, which has to be installed. Use the following command:
Code Block sudo yum install -y kubeadm
(Note that kubeadm automatically installs kubectl as a dependency)
Code Block |
---|
Code Block |
---|
Code Block |
---|
You can follow the below steps:
- Unzip the attached folder. The folder structure includes 3 files:
- js7-deployment.yaml – This file is the deployment file for the JS7
- js7-servcie.yaml – This includes the configuration of port forwarding
- hibernate.cfg.xml – This is the hibernate file for connection to the database.
- Edit the hibernate.cfg.xml file and adjust it according to your database credentials.
- Open CMD from the folder where you unzip attached ZIP.
- Run the command “kubectl create configmap hibernate-config --from-file=hibernate.cfg.xml” to create a config map and to pass this hibernate.cfg.xml file to the mount directory of the container.
- Run the command to create the YAML: “kubectl create -f js7-deployment.yaml” to create the deployment of JS7.
- Run the command to create the YAML: “kubectl create -f js7-service.yaml”
- kubectl describe pods - to check if there is any error or not.
- kubectl get pods - to check the status of pods
- kubectl get service - to check the IP and port of the kubernetes clusters
Deployment Files
Deployment File
=> insert the example file
Code Block |
---|
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: js7joc
name: js7joc
spec:
volumes:
- name: hibernate-config
configMap:
name: hibernate-config
containers:
- image: sosberlin/js7:joc-2-5-1
name: js7joc
ports:
- containerPort: 4446
volumeMounts:
- name: hibernate-config
mountPath: /var/sos-berlin.com/js7/joc/resources/joc/
env:
- name: RUN_JS_JAVA_OPTIONS
value: "-Xmx256m"
- name: RUN_JS_USER_ID
value: "0:0"
- name: RUN_JS_ID
value: "jobscheduler"
- image: sosberlin/js7:controller-2-5-1
name: js7con
ports:
- containerPort: 4444
env:
- name: RUN_JS_JAVA_OPTIONS
value: "-Xmx256m"
- name: RUN_JS_USER_ID
value: "0:0"
- name: RUN_JS_ID
value: "jobscheduler"
- image: sosberlin/js7:agent-2-5-1
name: js7agent
ports:
- containerPort: 4445 |
=> add explanations for specific settings
...
=> insert the example file
Code Block |
---|
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
run: js7joc
name: js7joc
spec:
ports:
- name: js7joc
port: 4446
protocol: TCP
targetPort: 4446
- name: js7agent
port: 4445
protocol: TCP
targetPort: 4445
- name: js7controller
port: 4444
protocol: TCP
targetPort: 4444
selector:
run: js7joc
type: LoadBalancer
status:
loadBalancer: {} |
=> add explanations for specific settings
...