Skip to content

Instantly share code, notes, and snippets.

View meysam81's full-sized avatar
📝
Learning

Meysam meysam81

📝
Learning
View GitHub Profile
import React, { useState, useEffect } from 'react';
import styles from './MotdForm.module.css';
const MotdForm = () => {
const [motd, setMotd] = useState('');
const [isEditing, setIsEditing] = useState(false);
const MOTD_EXPIRATION_KEY = 'motdExpiration';
const MOTD_KEY = 'motd';
This file has been truncated, but you can view the full file.
2024-03-26T13:03:45.224+0700 [INFO] Terraform version: 1.7.3
2024-03-26T13:03:45.224+0700 [DEBUG] using github.com/hashicorp/go-tfe v1.41.0
2024-03-26T13:03:45.224+0700 [DEBUG] using github.com/hashicorp/hcl/v2 v2.19.1
2024-03-26T13:03:45.224+0700 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-03-26T13:03:45.224+0700 [DEBUG] using github.com/zclconf/go-cty v1.14.1
2024-03-26T13:03:45.224+0700 [INFO] Go runtime version: go1.21.5
2024-03-26T13:03:45.224+0700 [INFO] CLI args: []string{"/home/meysam/.tfenv/versions/1.7.3/terraform", "plan", "-no-color", "-out", "tfplan"}
2024-03-26T13:03:45.224+0700 [TRACE] Stdout is not a terminal
2024-03-26T13:03:45.224+0700 [TRACE] Stderr is not a terminal
2024-03-26T13:03:45.225+0700 [TRACE] Stdin is a terminal
curl -sSfLo docker compose \
“https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64”
chmod +x docker compose
mkdir -p ~/.docker/cli-plugins
mv docker-compose ~/.docker/cli-plugins
RUN curl -sSfLo dumb-init \
"https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64" && \
chmod +x dumb-init && \
mv dumb-init /usr/local/bin/dumb-init
ENTRYPOINT [“/usr/local/bin/dumb-init”, “--”]
@meysam81
meysam81 / controlplane-playbook.yml
Created January 27, 2024 09:35
Passing vars files to the controlplane configuration
- name: Bootstrap Kubernetes Control plane
hosts: node0
become: true
gather_facts: true
vars_files:
- "{{ playbook_dir }}/vars/etcd.yml"
- "{{ playbook_dir }}/vars/k8s.yml"
- "{{ playbook_dir }}/vars/tls.yml"
tasks:
@meysam81
meysam81 / main.yml
Created January 27, 2024 09:32
Use the KubeConfig template to generate client configuration to the Kubernetes API server for different components
- name: Generate KubeConfig for Kubernetes components
ansible.builtin.template:
src: kubeconfig.yml.j2
dest: /var/lib/kubernetes/{{ item }}-kubeconfig.yml
mode: "0640"
owner: root
group: root
vars:
client_cert_path: /etc/kubernetes/pki/{{ item }}.crt
client_key_path: /etc/kubernetes/pki/{{ item }}.key
@meysam81
meysam81 / kubeconfig.yml
Last active January 27, 2024 09:30
The KubeConfig template to be used by each component to talk to the Kubernetes API server
apiVersion: v1
clusters:
- cluster:
certificate-authority: {{ ca_cert_path }}
server: https://{{ apiserver_ip }}:{{ apiserver_port | default(6443) }}
name: {{ kube_context }}
contexts:
- context:
cluster: {{ kube_context }}
user: {{ kube_context }}
@meysam81
meysam81 / main.yml
Created January 27, 2024 09:15
Creating the certificate for the CA
- name: Generate CA private key
community.crypto.openssl_privatekey:
path: /etc/kubernetes/pki/ca.key
type: RSA
- name: Generate CA CSR to provide ALT names and other options
community.crypto.openssl_csr:
basicConstraints_critical: true
basic_constraints:
- CA:TRUE
common_name: kubernetes-ca
@meysam81
meysam81 / main.yml
Created January 27, 2024 09:09
Kubernetes API server certificate generation
- name: Generate API Server private key
community.crypto.openssl_privatekey:
path: /etc/kubernetes/pki/kube-apiserver.key
type: RSA
- name: Generate API Server CSR
community.crypto.openssl_csr:
basicConstraints_critical: true
basic_constraints:
- CA:FALSE
common_name: kube-apiserver
@meysam81
meysam81 / controlplane-playbook.yml
Created January 27, 2024 07:54
Bootstrap the controlplane Kubernetes node
- name: Bootstrap Kubernetes Control plane
hosts: node0
become: true
gather_facts: true
tasks:
- name: Import bootstrap role
ansible.builtin.include_role:
name: bootstrap